dungeon_turn_limit = TURNS_PER_TICK * TOWN_DAWN * (MAX_DAYS - 1) + TURNS_PER_TICK * TOWN_DAWN * 3 / 4;
}
+
+/*
+ * Try to wield everything wieldable in the inventory.
+ * Code taken from Angband 3.1.0 under Angband license
+ */
+static void wield_all(void)
+{
+ object_type *o_ptr;
+ object_type *i_ptr;
+ object_type object_type_body;
+
+ int slot;
+ int item;
+
+ /* Scan through the slots backwards */
+ for (item = INVEN_PACK - 1; item >= 0; item--)
+ {
+ o_ptr = &inventory[item];
+
+ /* Skip non-objects */
+ if (!o_ptr->k_idx) continue;
+
+ /* Make sure we can wield it and that there's nothing else in that slot */
+ slot = wield_slot(o_ptr);
+ if (slot < INVEN_RARM) continue;
+ if (slot == INVEN_LITE) continue; /* Does not wield toaches because buys a lantern soon */
+ if (inventory[slot].k_idx) continue;
+
+ /* Get local object */
+ i_ptr = &object_type_body;
+ object_copy(i_ptr, o_ptr);
+
+ /* Modify quantity */
+ i_ptr->number = 1;
+
+ /* Decrease the item (from the pack) */
+ if (item >= 0)
+ {
+ inven_item_increase(item, -1);
+ inven_item_optimize(item);
+ }
+
+ /* Decrease the item (from the floor) */
+ else
+ {
+ floor_item_increase(0 - item, -1);
+ floor_item_optimize(0 - item);
+ }
+
+ /* Get the wield slot */
+ o_ptr = &inventory[slot];
+
+ /* Wear the new stuff */
+ object_copy(o_ptr, i_ptr);
+
+ /* Increase the weight */
+ p_ptr->total_weight += i_ptr->weight;
+
+ /* Increment the equip counter by hand */
+ equip_cnt++;
+
+ }
+ return;
+}
+
+
/*
* Each player starts out with a few items, given as tval/sval pairs.
* In addition, he always has some food and a few torches.
/* Auto-inscription */
autopick_alter_item(slot, FALSE);
+
+ /* Now try wielding everything */
+ wield_all();
}