BUGZILLA #548: Fixed crash (division to 0) when finishing training of mobile militia

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4582 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2011-07-21 13:58:50 +00:00
parent 2170bd5b4e
commit 9630f0f21f
+5 -1
View File
@@ -203,7 +203,11 @@ void GenerateMilitiaSquad(INT16 sMapX, INT16 sMapY, INT16 sTMapX, INT16 sTMapY,
ubBestLeadership = __min(ubBestLeadership, gGameExternalOptions.ubReqLeadershipForFullMobileTraining);
ubBestLeadership -= gGameExternalOptions.ubMinimumLeadershipToTrainMobileMilitia;
UINT8 ubBestLeadershipPercentage = (ubBestLeadership * 100) / bRange;
UINT8 ubBestLeadershipPercentage = 0;
if (bRange > 0)
ubBestLeadershipPercentage = (ubBestLeadership * 100) / bRange;
else
bRange = 0;
// There are five "grades", which in practice actually give a smooth transition from All-Green to All-Elite.
// Please note that if elite training is disabled, all elites will later be converted to Regulars. In that case,