Mercurial > mm7
changeset 2250:3cc3a29f073b
moved MerchandiseTest to ItemGen::MerchandiseTest
author | Grumpy7 |
---|---|
date | Wed, 26 Feb 2014 01:26:22 +0100 |
parents | 708aa31cad56 |
children | cd80d91b780f aff7a7b072b7 |
files | Items.cpp Items.h UI/UIShops.cpp mm7_4.cpp mm7_unsorted_subs.h |
diffstat | 5 files changed, 45 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/Items.cpp Wed Feb 26 01:20:07 2014 +0100 +++ b/Items.cpp Wed Feb 26 01:26:22 2014 +0100 @@ -3028,3 +3028,44 @@ return result; } + +//----- (004BDAAF) -------------------------------------------------------- +bool ItemGen::MerchandiseTest(int _2da_idx) +{ + bool test; + + if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)this->uItemID < 740 || (signed int)this->uItemID > 771) + && ((signed int)this->uItemID >= 600 || (signed int)this->uItemID >= 529 && (signed int)this->uItemID <= 599) || this->IsStolen()) + return false; + switch( p2DEvents[_2da_idx - 1].uType ) + { + case BuildingType_WeaponShop: + { + test = this->GetItemEquipType() <= EQUIP_BOW; + break; + } + case BuildingType_ArmorShop: + { + test = this->GetItemEquipType() >= EQUIP_ARMOUR && this->GetItemEquipType() <= EQUIP_BOOTS; + break; + } + case BuildingType_MagicShop: + { + test = this->GetPlayerSkillType() == PLAYER_SKILL_MISC || this->GetItemEquipType() == EQIUP_ANY; + break; + } + case BuildingType_AlchemistShop: + { + test = this->GetItemEquipType() == EQUIP_REAGENT || this->GetItemEquipType() == EQUIP_POTION + || (this->GetItemEquipType() > EQUIP_POTION && !(this->GetItemEquipType() != EQUIP_MESSAGE_SCROLL + || (signed int)this->uItemID < 740) && this->uItemID != 771); + break; + } + default: + { + test = false; + break; + } + } + return test; +} \ No newline at end of file
--- a/Items.h Wed Feb 26 01:20:07 2014 +0100 +++ b/Items.h Wed Feb 26 01:26:22 2014 +0100 @@ -251,7 +251,7 @@ unsigned __int8 GetDamageDice(); unsigned __int8 GetDamageRoll(); unsigned __int8 GetDamageMod(); - + bool MerchandiseTest(int _2da_idx); int uItemID; //0 int uEnchantmentType; //4 int m_enchantmentStrength; //8
--- a/UI/UIShops.cpp Wed Feb 26 01:20:07 2014 +0100 +++ b/UI/UIShops.cpp Wed Feb 26 01:26:22 2014 +0100 @@ -1540,7 +1540,7 @@ || pMouse->GetCursorPos(&cursor)->x >= 462 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) return; - if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) + if ( pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1].MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) { dword_F8B1E4 = 1; pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); @@ -1566,7 +1566,7 @@ item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; if ( !(item->uAttributes & ITEM_IDENTIFIED) ) { - if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) + if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) { if ( pParty->uNumGold >= uPriceItemService ) { @@ -1606,7 +1606,7 @@ uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); if ( item->uAttributes & ITEM_BROKEN ) { - if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) + if ( item->MerchandiseTest((int)window_SpeakInHouse->ptr_1C) ) { if ( pParty->uNumGold >= uPriceItemService ) {
--- a/mm7_4.cpp Wed Feb 26 01:20:07 2014 +0100 +++ b/mm7_4.cpp Wed Feb 26 01:26:22 2014 +0100 @@ -2332,43 +2332,3 @@ dword_7241C8 = 0; } -//----- (004BDAAF) -------------------------------------------------------- -bool MerchandiseTest(ItemGen *item, int _2da_idx) -{ - bool test; - - if ( (p2DEvents[_2da_idx - 1].uType != 4 || (signed int)item->uItemID < 740 || (signed int)item->uItemID > 771) - && ((signed int)item->uItemID >= 600 || (signed int)item->uItemID >= 529 && (signed int)item->uItemID <= 599) || item->IsStolen()) - return false; - switch( p2DEvents[_2da_idx - 1].uType ) - { - case BuildingType_WeaponShop: - { - test = item->GetItemEquipType() <= EQUIP_BOW; - break; - } - case BuildingType_ArmorShop: - { - test = item->GetItemEquipType() >= EQUIP_ARMOUR && item->GetItemEquipType() <= EQUIP_BOOTS; - break; - } - case BuildingType_MagicShop: - { - test = item->GetPlayerSkillType() == PLAYER_SKILL_MISC || item->GetItemEquipType() == EQIUP_ANY; - break; - } - case BuildingType_AlchemistShop: - { - test = item->GetItemEquipType() == EQUIP_REAGENT || item->GetItemEquipType() == EQUIP_POTION - || (item->GetItemEquipType() > EQUIP_POTION && !(item->GetItemEquipType() != EQUIP_MESSAGE_SCROLL - || (signed int)item->uItemID < 740) && item->uItemID != 771); - break; - } - default: - { - test = false; - break; - } - } - return test; -}
--- a/mm7_unsorted_subs.h Wed Feb 26 01:20:07 2014 +0100 +++ b/mm7_unsorted_subs.h Wed Feb 26 01:26:22 2014 +0100 @@ -175,7 +175,6 @@ void UI_CreateEndConversationButton(); void __fastcall OnSelectShopDialogueOption(signed int uMessageParam); int HouseDialogPressCloseBtn(); -bool MerchandiseTest(ItemGen *item, int _2da_idx); void UIShop_Buy_Identify_Repair(); bool __fastcall IsBModelVisible(unsigned int uModelID, int *unused); void ODM_LoadAndInitialize(const char *pLevelFilename, struct ODMRenderParams *thisa);