From b0eb1baf7ec966f1b84d90b650ae776dcbbb6b65 Mon Sep 17 00:00:00 2001 From: Wanne Date: Fri, 8 May 2009 13:37:22 +0000 Subject: [PATCH] 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 --- Tactical/Soldier Profile.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 29e727322..e88099eb0 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -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