From fe76b9e63ebc70c3f8916743001c2113896c2c04 Mon Sep 17 00:00:00 2001 From: MaddMugsy Date: Tue, 30 May 2006 21:10:26 +0000 Subject: [PATCH] -updated IMP Confirm.cpp to not choose illegal items from impitemchoices.xml (illegal = not on big gun list, coolness = 0) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@141 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameVersion.cpp | 2 +- Laptop/IMP Confirm.cpp | 41 +++++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index 6df225d0a..cc636def8 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -23,7 +23,7 @@ INT16 zVersionLabel[256] = { L"Beta v. 0.98" }; #else //RELEASE BUILD VERSION - INT16 zVersionLabel[256] = { L"Release v1.13.139" }; + INT16 zVersionLabel[256] = { L"Release v1.13.141" }; #endif diff --git a/Laptop/IMP Confirm.cpp b/Laptop/IMP Confirm.cpp index 88fc2de69..9a58caa45 100644 --- a/Laptop/IMP Confirm.cpp +++ b/Laptop/IMP Confirm.cpp @@ -818,9 +818,13 @@ void GiveIMPRandomItems( MERCPROFILESTRUCT *pProfile, UINT8 typeIndex ) for ( int i=0; i < gIMPItemChoices[typeIndex].ubNumItems ;i++ ) { - iChoice = Random(gIMPItemChoices[ typeIndex ].ubChoices); - usItem = gIMPItemChoices[ typeIndex ].bItemNo[ iChoice ]; - + while (usItem == 0 ) + { + iChoice = Random(gIMPItemChoices[ typeIndex ].ubChoices); + usItem = gIMPItemChoices[ typeIndex ].bItemNo[ iChoice ]; + if (!ItemIsLegal(usItem)) + usItem=0; + } DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPRandomItems: typeIndex = %d, usItem = %d ",typeIndex, usItem )); if ( usItem > 0 ) MakeProfileInvItemAnySlot(pProfile,usItem,100,1); @@ -865,26 +869,27 @@ void GiveIMPItems( MERCPROFILESTRUCT *pProfile, INT8 abilityValue, UINT8 typeInd DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: 2 iChoice = %d",iChoice)); usItem = gIMPItemChoices[ typeIndex ].bItemNo[ iChoice ]; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: typeIndex = %d, usItem = %d, iChoice = %d, abilityValue = %d",typeIndex, usItem,iChoice, abilityValue )); - if ( usItem > 0 ) + if ( usItem > 0 && ItemIsLegal(usItem)) + { MakeProfileInvItemAnySlot(pProfile,usItem,100,1); - // give ammo for guns - if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) - { - usItem = DefaultMagazine(usItem); - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give ammo typeIndex = %d, usItem = %d",typeIndex, usItem )); - MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); - } + // give ammo for guns + if ( Item[usItem].usItemClass == IC_GUN && !Item[usItem].rocketlauncher ) + { + usItem = DefaultMagazine(usItem); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give ammo typeIndex = %d, usItem = %d",typeIndex, usItem )); + MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + } - // give launchables for launchers - if ( Item[usItem].usItemClass == IC_LAUNCHER ) - { - usItem = PickARandomLaunchable(usItem); - DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give launchable typeIndex = %d, usItem = %d",typeIndex, usItem )); - MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + // give launchables for launchers + if ( Item[usItem].usItemClass == IC_LAUNCHER ) + { + usItem = PickARandomLaunchable(usItem); + DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("GiveIMPItems: give launchable typeIndex = %d, usItem = %d",typeIndex, usItem )); + MakeProfileInvItemAnySlot(pProfile,usItem,100,(1+Random(3))); + } } - iChoice--; if (iChoice < 0) iChoice = 0;