src/player-birth.c
static void player_outfit(struct player *p)
{
	char buf[80];
	int i;
	const struct start_item *si;

	/* Player needs a body */
	memcpy(&p->body, &bodies[p->race->body], sizeof(p->body));
	my_strcpy(buf, bodies[p->race->body].name, sizeof(buf));
	p->body.name = string_make(buf);
	p->body.slots = mem_zalloc(p->body.count * sizeof(struct equip_slot));
	for (i = 0; i < p->body.count; i++) {
		p->body.slots[i].type = bodies[p->race->body].slots[i].type;
		my_strcpy(buf, bodies[p->race->body].slots[i].name, sizeof(buf));
		p->body.slots[i].name = string_make(buf);
	}

	/* Currently carrying nothing */
	p->upkeep->total_weight = 0;

	/* Give the player starting equipment */
	for (si = p->class->start_items; si; si = si->next) {
		/* Get local object */
		struct object *obj = object_new();
		int num = rand_range(si->min, si->max);

		/* Without start_kit, only start with 1 food and 1 light */
		if (!OPT(birth_start_kit)) {
			if (!tval_is_food_k(si->kind) && !tval_is_light_k(si->kind))
				continue;

			num = 1;
		}

		/* Prepare the item */
		object_prep(obj, si->kind, 0, MINIMISE);
		obj->number = num;
		obj->origin = ORIGIN_BIRTH;

		object_flavor_aware(obj);
		object_notice_everything(obj);
		apply_autoinscription(obj);

		/* Deduct the cost of the item from starting cash */
		p->au -= object_value(obj, obj->number, FALSE);

		/* Carry the item */
		inven_carry(p, obj, TRUE, FALSE);
		si->kind->everseen = TRUE;
	}

	/* Sanity check */
	if (p->au < 0)
		p->au = 0;

	/* Now try wielding everything */
	wield_all(p);
}
/**
 * Init players with some belongings
 *
 * Having an item identifies it and makes the player "aware" of its purpose.
 */
Init players with some belongings
Having an item identifies it and makes the player "aware" of its purpose.
Init players with some belongings Having an item identifies it and makes the player " aware " of its purpose .
static void player_outfit(struct player *p)
{
	char buf[80];
	int i;
	const struct start_item *si;
	memcpy(&p->body, &bodies[p->race->body], sizeof(p->body));
	my_strcpy(buf, bodies[p->race->body].name, sizeof(buf));
	p->body.name = string_make(buf);
	p->body.slots = mem_zalloc(p->body.count * sizeof(struct equip_slot));
	for (i = 0; i < p->body.count; i++) {
		p->body.slots[i].type = bodies[p->race->body].slots[i].type;
		my_strcpy(buf, bodies[p->race->body].slots[i].name, sizeof(buf));
		p->body.slots[i].name = string_make(buf);
	}
	p->upkeep->total_weight = 0;
	for (si = p->class->start_items; si; si = si->next) {
		struct object *obj = object_new();
		int num = rand_range(si->min, si->max);
		if (!OPT(birth_start_kit)) {
			if (!tval_is_food_k(si->kind) && !tval_is_light_k(si->kind))
				continue;
			num = 1;
		}
		object_prep(obj, si->kind, 0, MINIMISE);
		obj->number = num;
		obj->origin = ORIGIN_BIRTH;
		object_flavor_aware(obj);
		object_notice_everything(obj);
		apply_autoinscription(obj);
		p->au -= object_value(obj, obj->number, FALSE);
		inven_carry(p, obj, TRUE, FALSE);
		si->kind->everseen = TRUE;
	}
	if (p->au < 0)
		p->au = 0;
	wield_all(p);
}
static void player_outfit ( struct player * p ) { char buf [ 80 ] ; int i ; const struct start_item * si ; memcpy ( & p -> body , & bodies [ p -> race -> body ] , sizeof ( p -> body ) ) ; my_strcpy ( buf , bodies [ p -> race -> body ] . name , sizeof ( buf ) ) ; p -> body . name = string_make ( buf ) ; p -> body . slots = mem_zalloc ( p -> body . count * sizeof ( struct equip_slot ) ) ; for ( i = 0 ; i < p -> body . count ; i ++ ) { p -> body . slots [ i ] . type = bodies [ p -> race -> body ] . slots [ i ] . type ; my_strcpy ( buf , bodies [ p -> race -> body ] . slots [ i ] . name , sizeof ( buf ) ) ; p -> body . slots [ i ] . name = string_make ( buf ) ; } p -> upkeep -> total_weight = 0 ; for ( si = p -> class -> start_items ; si ; si = si -> next ) { struct object * obj = object_new ( ) ; int num = rand_range ( si -> min , si -> max ) ; if ( ! OPT ( birth_start_kit ) ) { if ( ! tval_is_food_k ( si -> kind ) && ! tval_is_light_k ( si -> kind ) ) continue ; num = 1 ; } object_prep ( obj , si -> kind , 0 , MINIMISE ) ; obj -> number = num ; obj -> origin = ORIGIN_BIRTH ; object_flavor_aware ( obj ) ; object_notice_everything ( obj ) ; apply_autoinscription ( obj ) ; p -> au -= object_value ( obj , obj -> number , FALSE ) ; inven_carry ( p , obj , TRUE , FALSE ) ; si -> kind -> everseen = TRUE ; } if ( p -> au < 0 ) p -> au = 0 ; wield_all ( p ) ; }
Init players with some belongings
 Having an item identifies it and makes the player "aware" of its purpose.
Init players with some belongings Having an item identifies it and makes the player " aware " of its purpose .
/* Player needs a body */ /* Currently carrying nothing */ /* Give the player starting equipment */ /* Get local object */ /* Without start_kit, only start with 1 food and 1 light */ /* Prepare the item */ /* Deduct the cost of the item from starting cash */ /* Carry the item */ /* Sanity check */ /* Now try wielding everything */