Mercurial > mm7
diff Player.cpp @ 1563:0311debb684c
splitting Player::WearsItem into two functions
author | Grumpy7 |
---|---|
date | Sun, 08 Sep 2013 02:41:10 +0200 |
parents | f8c15e45de7e |
children | 461c2eca401b |
line wrap: on
line diff
--- a/Player.cpp Sun Sep 08 01:23:37 2013 +0200 +++ b/Player.cpp Sun Sep 08 02:41:10 2013 +0200 @@ -1996,7 +1996,6 @@ { if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) - // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment) return true; } return false; @@ -2004,25 +2003,20 @@ //----- (0048D709) -------------------------------------------------------- bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) - { - - int v6; // esi@5 - - if ( equip_type >= 16 ) - { - v6 = 0; - while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) - || pInventoryItemList[pEquipment.pIndices[v6] - 1].uItemID != item_id ) - { - ++v6; - if ( (signed int)v6 >= 16 ) - return 0; - } - return 1; - } - if ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) - return 1; - return 0; +{ + return ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ); +} + +bool Player::WearsItemAnyWhere(int item_id) +{ + for (int i = 0; i < 16; i++) + { + if (WearsItem(item_id, (ITEM_EQUIP_TYPE) i)) + { + return true; + } + } + return false; } //----- (0048D76C) --------------------------------------------------------