Resolved a Strategic AI.cpp assertion error resulting from army composition values totaling more then 100%.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2389 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
ChrisL
2008-10-30 16:03:40 +00:00
parent ef158c56cf
commit 8c437af085
3 changed files with 22 additions and 8 deletions
+4 -4
View File
@@ -13,12 +13,12 @@
#ifdef JA2EDITOR #ifdef JA2EDITOR
//MAP EDITOR BUILD VERSION //MAP EDITOR BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2385" }; CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.2389" };
#elif defined JA2BETAVERSION #elif defined JA2BETAVERSION
//BETA/TEST BUILD VERSION //BETA/TEST BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Debug v1.13.2385" }; CHAR16 zVersionLabel[256] = { L"Debug v1.13.2389" };
#elif defined CRIPPLED_VERSION #elif defined CRIPPLED_VERSION
@@ -28,11 +28,11 @@ CHAR16 zVersionLabel[256] = { L"Beta v. 0.98" };
#else #else
//RELEASE BUILD VERSION //RELEASE BUILD VERSION
CHAR16 zVersionLabel[256] = { L"Release v1.13.2385" }; CHAR16 zVersionLabel[256] = { L"Release v1.13.2389" };
#endif #endif
CHAR8 czVersionNumber[16] = { "Build 08.10.28" }; //YY.MM.DD CHAR8 czVersionNumber[16] = { "Build 08.10.30" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" }; CHAR16 zTrackingNumber[16] = { L"Z" };
+14
View File
@@ -5653,6 +5653,20 @@ void CalcNumTroopsBasedOnComposition( UINT8 *pubNumTroops, UINT8 *pubNumElites,
(*pubNumElites)++; (*pubNumElites)++;
} }
} }
//CHRISL: For some reason, it's possible for pubNumTroops + pubNumElites to be greater then ubTotal. It seems that in some
// cases, bTroopPercentage and bElitePercentage can add up to more then 100%. So we need an extra condition that makes
// sure we don't have more then ubTotal
while( *pubNumTroops + *pubNumElites > ubTotal)
{
if( Chance( gArmyComp[ iCompositionID ].bTroopPercentage ) )
{
(*pubNumTroops)--;
}
else
{
(*pubNumElites)--;
}
}
Assert( *pubNumTroops + *pubNumElites == ubTotal ); Assert( *pubNumTroops + *pubNumElites == ubTotal );
} }
+4 -4
View File
@@ -66,7 +66,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
OutputFile="$(OutDir)\ja2_debug_2385_en.exe" OutputFile="$(OutDir)\ja2_debug_2389_en.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"
@@ -145,7 +145,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
OutputFile="$(OutDir)\ja2_release_2385_en.exe" OutputFile="$(OutDir)\ja2_release_2389_en.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true" GenerateMapFile="true"
@@ -229,7 +229,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStatic.lib ws2_32.lib"
OutputFile="$(OutDir)\Map Editor_2385_en.exe" OutputFile="$(OutDir)\Map Editor_2389_en.exe"
LinkIncremental="1" LinkIncremental="1"
GenerateDebugInformation="true" GenerateDebugInformation="true"
GenerateMapFile="true" GenerateMapFile="true"
@@ -316,7 +316,7 @@
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib" AdditionalDependencies="Winmm.lib .\Multiplayer\raknet\RakNetLibStaticDebug.lib ws2_32.lib"
OutputFile="$(OutDir)\Map EditorD_2385_en.exe" OutputFile="$(OutDir)\Map EditorD_2389_en.exe"
LinkIncremental="2" LinkIncremental="2"
GenerateDebugInformation="true" GenerateDebugInformation="true"
SubSystem="2" SubSystem="2"