comparison 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
comparison
equal deleted inserted replaced
1562:c44db078127d 1563:0311debb684c
1994 { 1994 {
1995 for (uint i = 0; i < 16; ++i) 1995 for (uint i = 0; i < 16; ++i)
1996 { 1996 {
1997 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) && 1997 if (HasItemEquipped((ITEM_EQUIP_TYPE)i) &&
1998 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment) 1998 pOwnItems[pEquipment.pIndices[i]-1].uSpecEnchantmentType == uEnchantment)
1999 // *(int *)&this->field_1F6[36 * pEquipment[i] + 6] != uEnchantment)
2000 return true; 1999 return true;
2001 } 2000 }
2002 return false; 2001 return false;
2003 } 2002 }
2004 2003
2005 //----- (0048D709) -------------------------------------------------------- 2004 //----- (0048D709) --------------------------------------------------------
2006 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type ) 2005 bool Player::WearsItem( int item_id, ITEM_EQUIP_TYPE equip_type )
2007 { 2006 {
2008 2007 return ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id );
2009 int v6; // esi@5 2008 }
2010 2009
2011 if ( equip_type >= 16 ) 2010 bool Player::WearsItemAnyWhere(int item_id)
2012 { 2011 {
2013 v6 = 0; 2012 for (int i = 0; i < 16; i++)
2014 while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) 2013 {
2015 || pInventoryItemList[pEquipment.pIndices[v6] - 1].uItemID != item_id ) 2014 if (WearsItem(item_id, (ITEM_EQUIP_TYPE) i))
2016 { 2015 {
2017 ++v6; 2016 return true;
2018 if ( (signed int)v6 >= 16 ) 2017 }
2019 return 0; 2018 }
2020 } 2019 return false;
2021 return 1;
2022 }
2023 if ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id )
2024 return 1;
2025 return 0;
2026 } 2020 }
2027 2021
2028 //----- (0048D76C) -------------------------------------------------------- 2022 //----- (0048D76C) --------------------------------------------------------
2029 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6) 2023 bool Player::StealFromShop(ItemGen *a2, int a3, int a4, int a5, int *a6)
2030 { 2024 {