From 2d5c6e29961669f84942727a3fa9985be198f334 Mon Sep 17 00:00:00 2001 From: ChrisL Date: Thu, 17 Apr 2008 16:47:50 +0000 Subject: [PATCH] Fixed a bug in the "sell all" strategic inventory screen options. Money now gets sold without modification and unreachable items can't accidentally be sold. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2039 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameVersion.cpp | 8 ++--- .../Map Screen Interface Map Inventory.cpp | 9 +++++ Strategic/mapscreen.cpp | 33 ++++++++++--------- ja2_2005Express.vcproj | 4 +-- 4 files changed, 33 insertions(+), 21 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index ecaf76dda..d85bc0bcb 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -13,12 +13,12 @@ #ifdef JA2EDITOR //MAP EDITOR BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2037" }; +CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2039" }; #elif defined JA2BETAVERSION //BETA/TEST BUILD VERSION -CHAR16 zVersionLabel[256] = { L"Debug v1.13.2037" }; +CHAR16 zVersionLabel[256] = { L"Debug v1.13.2039" }; #elif defined CRIPPLED_VERSION @@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - CHAR16 zVersionLabel[256] = { L"Release v1.13.2037" }; + CHAR16 zVersionLabel[256] = { L"Release v1.13.2039" }; #endif -CHAR8 czVersionNumber[16] = { "Build 08.04.16" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 08.04.17" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; diff --git a/Strategic/Map Screen Interface Map Inventory.cpp b/Strategic/Map Screen Interface Map Inventory.cpp index 9445d1d38..238de6e76 100644 --- a/Strategic/Map Screen Interface Map Inventory.cpp +++ b/Strategic/Map Screen Interface Map Inventory.cpp @@ -2309,6 +2309,15 @@ INT32 SellItem( OBJECTTYPE& object, BOOLEAN useModifier ) iPrice += (INT32)( itemPrice * (float) object[bLoop]->data.ubShotsLeft / magSize ); } } + //CHRISL: If we're dealing with money, we want to use the money's amount and just return that value with no modification + else if(Item[usItemType].usItemClass == IC_MONEY) + { + for (INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++) + { + iPrice += (INT32)(object[bLoop]->data.money.uiMoneyAmount); + } + return iPrice; + } else if(Item[usItemType].usItemClass == IC_LBEGEAR && UsingNewInventorySystem() == true) { //CHRISL: If we're selling an LBE Item, we need to verify if it's an LBENODE, first. If it is, we need to sell diff --git a/Strategic/mapscreen.cpp b/Strategic/mapscreen.cpp index 6d5f0402f..21224918b 100644 --- a/Strategic/mapscreen.cpp +++ b/Strategic/mapscreen.cpp @@ -1075,23 +1075,26 @@ void BeginSellAllCallBack( UINT8 bExitValue ) } for(UINT32 wItem = 0; wItem < guiNumWorldItems; wItem++) { - if(0 == pInventoryPoolList[wItem].object.MoveThisObjectTo(gItemPointer,-1,0,NUM_INV_SLOTS,MAX_OBJECTS_PER_SLOT)) + if(pInventoryPoolList[wItem].object.exists() == true && (pInventoryPoolList[wItem].usFlags & WORLD_ITEM_REACHABLE)) { - if (pInventoryPoolList[wItem].object.exists() == false) { - pInventoryPoolList[wItem].object.initialize(); + if(0 == pInventoryPoolList[wItem].object.MoveThisObjectTo(gItemPointer,-1,0,NUM_INV_SLOTS,MAX_OBJECTS_PER_SLOT)) + { + if (pInventoryPoolList[wItem].object.exists() == false) { + pInventoryPoolList[wItem].object.initialize(); + } + // Dirty interface + fMapPanelDirty = TRUE; + gpItemPointer = &gItemPointer; + // Sell Item + iPrice += SellItem( gItemPointer ); + gpItemPointer = NULL; + fMapInventoryItem = FALSE; + if (iPrice == 0) { + iPrice = 1; + } + anythingSold = true; + HandleButtonStatesWhileMapInventoryActive(); } - // Dirty interface - fMapPanelDirty = TRUE; - gpItemPointer = &gItemPointer; - // Sell Item - iPrice += SellItem( gItemPointer ); - gpItemPointer = NULL; - fMapInventoryItem = FALSE; - if (iPrice == 0) { - iPrice = 1; - } - anythingSold = true; - HandleButtonStatesWhileMapInventoryActive(); } } if(anythingSold == true) diff --git a/ja2_2005Express.vcproj b/ja2_2005Express.vcproj index eacacb198..d6f1fe0a2 100644 --- a/ja2_2005Express.vcproj +++ b/ja2_2005Express.vcproj @@ -66,7 +66,7 @@