-minor fix: PickARandomLaunchable now looks at the HighestPlayerProgress percentage, so early enemy GLs won't use thermobarics

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@482 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
MaddMugsy
2006-08-28 17:46:44 +00:00
parent 9294f1029e
commit f2d401b769
+21 -4
View File
@@ -7342,6 +7342,23 @@ INT8 FindRemoteControl( SOLDIERTYPE * pSoldier )
return( NO_SLOT );
}
UINT16 LowestLaunchableCoolness(UINT16 launcherIndex)
{
UINT16 i = 0;
UINT16 lowestCoolness = 999;
for( i = 0; i < MAXITEMS; i++ )
{
if ( Item[i].usItemClass == 0 )
break;
if( ValidLaunchable( i, launcherIndex ) && Item[i].ubCoolness <= lowestCoolness )
{
lowestCoolness = Item[i].ubCoolness;
}
}
return lowestCoolness;
}
UINT16 PickARandomLaunchable(UINT16 itemIndex)
{
@@ -7349,7 +7366,7 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex)
UINT16 usNumMatches = 0;
UINT16 usRandom = 0;
UINT16 i = 0;
UINT16 lowestCoolness = LowestLaunchableCoolness(itemIndex);
//DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("PickARandomLaunchable: itemIndex = %d", itemIndex));
while( !usNumMatches )
@@ -7358,8 +7375,8 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex)
{
if ( Item[i].usItemClass == 0 )
break;
if( ValidLaunchable( i, itemIndex ) )
//Madd: quickfix: make it not choose best grenades right away.
if( ValidLaunchable( i, itemIndex ) && Item[i].ubCoolness <= max(HighestPlayerProgressPercentage()/10,lowestCoolness) )
usNumMatches++;
}
}
@@ -7371,7 +7388,7 @@ UINT16 PickARandomLaunchable(UINT16 itemIndex)
if ( Item[i].usItemClass == 0 )
break;
if( ValidLaunchable( i, itemIndex ) )
if( ValidLaunchable( i, itemIndex ) && Item[i].ubCoolness <= max(HighestPlayerProgressPercentage()/10,lowestCoolness) )
{
if( usRandom )
usRandom--;