From e2ad50963b567f4689c29923ec4b394067b583e5 Mon Sep 17 00:00:00 2001 From: ChrisL Date: Fri, 25 Apr 2008 18:17:53 +0000 Subject: [PATCH] Bugfix that removes a rare CTD that can occur if a non-LBE item accidentally gets associated with a merc. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2077 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Panels.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Tactical/Interface Panels.cpp b/Tactical/Interface Panels.cpp index fd885fc83..d056970d1 100644 --- a/Tactical/Interface Panels.cpp +++ b/Tactical/Interface Panels.cpp @@ -3624,7 +3624,11 @@ BOOLEAN ChangeDropPackStatus(SOLDIERTYPE *pSoldier, BOOLEAN newStatus) { for(unsigned int wi = 0; wi < guiNumWorldItems; wi++) { - if(gWorldItems[wi].soldierID == pSoldier->ubID && gWorldItems[wi].object.exists() == true && LoadBearingEquipment[Item[gWorldItems[wi].object.usItem].ubClassIndex].lbeClass == BACKPACK) + //CHRISL: There's the remote chance that a non-LBE item might get associated with a merc. If that happens, we can + // have a CTD, so lets resolve that here. + if(Item[gWorldItems[wi].object.usItem].usItemClass != IC_LBEGEAR) + gWorldItems[wi].soldierID = -1; + if(gWorldItems[wi].soldierID == pSoldier->ubID && gWorldItems[wi].object.exists() == true && Item[gWorldItems[wi].object.usItem].usItemClass == IC_LBEGEAR && LoadBearingEquipment[Item[gWorldItems[wi].object.usItem].ubClassIndex].lbeClass == BACKPACK) { for (int x = 0; x < gWorldItems[wi].object.ubNumberOfObjects; ++x) { // Is the item we dropped in this sector and does it have an active LBENODE flag?