Bugfix: Enable all terrorists in game, if all terrorists should be available (defined in the ja2_options.ini) (fix by Sandro)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2830 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2009-05-08 13:37:22 +00:00
parent c989565c44
commit b0eb1baf7e
+15 -6
View File
@@ -477,7 +477,7 @@ BOOLEAN LoadMercProfiles(void)
return(TRUE);
}
#define MAX_ADDITIONAL_TERRORISTS 4
#define MAX_ADDITIONAL_TERRORISTS 5 // instead of 4
void DecideActiveTerrorists( void )
{
@@ -486,7 +486,7 @@ void DecideActiveTerrorists( void )
UINT8 ubNumAdditionalTerrorists, ubNumTerroristsAdded = 0;
UINT32 uiChance, uiLocationChoice;
BOOLEAN fFoundSpot;
INT16 sTerroristPlacement[MAX_ADDITIONAL_TERRORISTS][2] = { {0, 0}, {0, 0}, {0, 0}, {0, 0} };
INT16 sTerroristPlacement[MAX_ADDITIONAL_TERRORISTS][2] = { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} }; // added one here
#ifdef CRIPPLED_VERSION
return;
@@ -512,12 +512,15 @@ void DecideActiveTerrorists( void )
break;
}
if ( gGameExternalOptions.fEnableAllTerrorists )
uiChance = 100;
//////////////////////////////////////////////////////////////////////////
// this makes no sense now, we just set the exact number of them below
//if ( gGameExternalOptions.fEnableAllTerrorists )
// uiChance = 100;
//////////////////////////////////////////////////////////////////////////
// add at least 2 more
ubNumAdditionalTerrorists = 2;
for (ubLoop = 0; ubLoop < (MAX_ADDITIONAL_TERRORISTS - 2); ubLoop++)
for (ubLoop = 0; ubLoop < (MAX_ADDITIONAL_TERRORISTS - 3); ubLoop++) // -3 instead of -2 because we increased MAX_ADDITIONAL_TERRORISTS above by 1
{
if (Random( 100 ) < uiChance)
{
@@ -525,6 +528,12 @@ void DecideActiveTerrorists( void )
}
}
/////////////////////////////////////////////////////
// Added so with ENABLE_ALL_TERRORISTS you really get all of them (5 + Charlie)
if ( gGameExternalOptions.fEnableAllTerrorists )
ubNumAdditionalTerrorists = 5;
/////////////////////////////////////////////////////
// ifdefs added by CJC
#ifdef JA2TESTVERSION
ubNumAdditionalTerrorists = 4;
@@ -542,7 +551,7 @@ void DecideActiveTerrorists( void )
ubTerrorist = gubTerrorists[ ubLoop ];
// random 40% chance of adding this terrorist if not yet placed
if ( ( gMercProfiles[ ubTerrorist ].sSectorX == 0 ) && ( Random( 100 ) < 40 ) )
if ( ( gMercProfiles[ ubTerrorist ].sSectorX == 0 ) && (( Random( 100 ) < 40 ) || gGameExternalOptions.fEnableAllTerrorists ) ) // also added the check because it makes no sense to choose randomly which terrorist will be in game, all of them should
{
fFoundSpot = FALSE;
// Since there are 5 spots per terrorist and a maximum of 5 terrorists, we