src/player-birth.c
void wield_all(struct player *p)
{
	struct object *obj, *new_pile = NULL;
	int slot;

	/* Scan through the slots */
	for (obj = p->gear; obj; obj = obj->next) {
		struct object *obj_temp;

		/* Skip non-objects */
		assert(obj);

		/* Make sure we can wield it */
		slot = wield_slot(obj);
		if (slot < 0 || slot >= p->body.count)
			continue;

		obj_temp = slot_object(p, slot);
		if (obj_temp)
			continue;

		/* Split if necessary */
		if (obj->number > 1) {
			/* All but one go to the new object */
			struct object *new = object_split(obj, obj->number - 1);

			/* Add to the pile of new objects to carry */
			pile_insert(&new_pile, new);
		}

		/* Wear the new stuff */
		p->body.slots[slot].obj = obj;

		/* Increment the equip counter by hand */
		p->upkeep->equip_cnt++;
	}

	/* Now add the unwielded split objects to the gear */
	if (new_pile)
		pile_insert_end(&player->gear, new_pile);

	return;
}
/**
 * Try to wield everything wieldable in the inventory.
 */
Try to wield everything wieldable in the inventory.
Try to wield everything wieldable in the inventory .
void wield_all(struct player *p)
{
	struct object *obj, *new_pile = NULL;
	int slot;
	for (obj = p->gear; obj; obj = obj->next) {
		struct object *obj_temp;
		assert(obj);
		slot = wield_slot(obj);
		if (slot < 0 || slot >= p->body.count)
			continue;
		obj_temp = slot_object(p, slot);
		if (obj_temp)
			continue;
		if (obj->number > 1) {
			struct object *new = object_split(obj, obj->number - 1);
			pile_insert(&new_pile, new);
		}
		p->body.slots[slot].obj = obj;
		p->upkeep->equip_cnt++;
	}
	if (new_pile)
		pile_insert_end(&player->gear, new_pile);
	return;
}
void wield_all ( struct player * p ) { struct object * obj , * new_pile = NULL ; int slot ; for ( obj = p -> gear ; obj ; obj = obj -> next ) { struct object * obj_temp ; assert ( obj ) ; slot = wield_slot ( obj ) ; if ( slot < 0 || slot >= p -> body . count ) continue ; obj_temp = slot_object ( p , slot ) ; if ( obj_temp ) continue ; if ( obj -> number > 1 ) { struct object * new = object_split ( obj , obj -> number - 1 ) ; pile_insert ( & new_pile , new ) ; } p -> body . slots [ slot ] . obj = obj ; p -> upkeep -> equip_cnt ++ ; } if ( new_pile ) pile_insert_end ( & player -> gear , new_pile ) ; return ; }
Try to wield everything wieldable in the inventory.
Try to wield everything wieldable in the inventory .
/* Scan through the slots */ /* Skip non-objects */ /* Make sure we can wield it */ /* Split if necessary */ /* All but one go to the new object */ /* Add to the pile of new objects to carry */ /* Wear the new stuff */ /* Increment the equip counter by hand */ /* Now add the unwielded split objects to the gear */