From f5402c6852b943fc0048685573f1c9b4c366a25c Mon Sep 17 00:00:00 2001 From: iks Date: Mon, 16 Mar 2009 07:46:39 +0000 Subject: [PATCH] =?utf8?q?Angband3.1.0=E3=81=AE=E3=80=81=E3=82=AD=E3=83=A3?= =?utf8?q?=E3=83=A9=E7=94=9F=E6=88=90=E6=99=82=E3=81=AB=E8=A3=85=E5=82=99?= =?utf8?q?=E3=82=92=E8=87=AA=E5=8B=95=E8=A3=85=E5=82=99=E3=81=99=E3=82=8B?= =?utf8?q?=E3=82=B3=E3=83=BC=E3=83=89=E3=82=92=E5=8F=96=E3=82=8A=E8=BE=BC?= =?utf8?q?=E3=82=93=E3=81=A0=E3=80=82=E3=81=9F=E3=81=A0=E3=81=97=E3=80=81?= =?utf8?q?=E5=85=89=E6=BA=90=E3=81=AF=E8=87=AA=E5=8B=95=E8=A3=85=E5=82=99?= =?utf8?q?=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=97?= =?utf8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/birth.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/src/birth.c b/src/birth.c index 3f7b56f91..eb1ec7908 100644 --- a/src/birth.c +++ b/src/birth.c @@ -3530,6 +3530,72 @@ static void init_turn(void) 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. @@ -3753,6 +3819,9 @@ static void add_outfit(object_type *o_ptr) /* Auto-inscription */ autopick_alter_item(slot, FALSE); + + /* Now try wielding everything */ + wield_all(); } -- 2.11.0