From 6565f14bc3ddcbbd9c57262010d714bfe10f508b Mon Sep 17 00:00:00 2001 From: ChrisL Date: Fri, 16 May 2008 17:25:46 +0000 Subject: [PATCH] Fix for Bug#99 Fix for Bug#100 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2170 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Arms Dealer Init.cpp | 6 +++++- Tactical/ShopKeeper Interface.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Tactical/Arms Dealer Init.cpp b/Tactical/Arms Dealer Init.cpp index 0f533ca5..1272a0fe 100644 --- a/Tactical/Arms Dealer Init.cpp +++ b/Tactical/Arms Dealer Init.cpp @@ -1708,7 +1708,11 @@ void MakeObjectOutOfDealerItems( DEALER_SPECIAL_ITEM *pSpclItemInfo, OBJECTTYPE // have to keep track of #bullets in a gun throughout dealer inventory. Without this, players could "reload" guns // they don't have ammo for by selling them to Tony & buying them right back fully loaded! One could repeat this // ad nauseum (empty the gun between visits) as a (really expensive) way to get unlimited special ammo like rockets. - (*pObject)[subObject]->data.gun.ubGunShotsLeft = 0; + //CHRISL: If we're working with a SingleShotRocketLauncher, we need ubGunShotsLeft to equal 1 + if(Item[pObject->usItem].singleshotrocketlauncher == TRUE) + (*pObject)[subObject]->data.gun.ubGunShotsLeft = 1; + else + (*pObject)[subObject]->data.gun.ubGunShotsLeft = 0; } } } diff --git a/Tactical/ShopKeeper Interface.cpp b/Tactical/ShopKeeper Interface.cpp index 323a4fa7..9e3e0260 100644 --- a/Tactical/ShopKeeper Interface.cpp +++ b/Tactical/ShopKeeper Interface.cpp @@ -6589,7 +6589,11 @@ void SplitComplexObjectIntoSubObjects( OBJECTTYPE *pComplexObject ) subObjects.clear(); int usItem = pComplexObject->usItem; - for (int x = 0; x < pComplexObject->ubNumberOfObjects; ++x) { + //CHRISL: This won't work. As we his MoveThisObjectTo, we reduce ubNumberOfObjects. If we started with ubNumberOfObjects=4 & x=0, + // our first iteration would be ubNumberOfObjects=3 & x=1. Then ubNumberOfObjects=2 & x=2, which ends the loop. We want to + // run the loop ubNumberOfObjects number of times regardless of whether ubNumberOfObjects is reduced. Use a while loop. + //for (int x = 0; x < pComplexObject->ubNumberOfObjects; ++x) { + while(pComplexObject->ubNumberOfObjects > 0) { //we need not worry about attachments!!!! if (pComplexObject->MoveThisObjectTo(gTempObject, 1) == 0) {