-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
This commit is contained in:
MaddMugsy
2006-05-30 21:10:26 +00:00
parent ba211d76b6
commit fe76b9e63e
2 changed files with 24 additions and 19 deletions
+1 -1
View File
@@ -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
+23 -18
View File
@@ -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;