Fix: determining a militia path in strategic map could cause the sector militia size to be cut to MAX_STRATEGIC_ENEMY_GROUP_SIZE

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8243 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2016-05-28 15:07:44 +00:00
parent 7b288c5c83
commit 2c85d6dc03
4 changed files with 32 additions and 22 deletions
+9 -4
View File
@@ -2146,11 +2146,16 @@ void RetreatAllInvolvedMilitiaGroups()
if ( !pSector )
return;
pGroup = CreateNewMilitiaGroupDepartingFromSector( SECTOR( sBattleSectorX, sBattleSectorY ), pSector->ubNumberOfCivsAtLevel[0], pSector->ubNumberOfCivsAtLevel[1], pSector->ubNumberOfCivsAtLevel[2] );
// as group size will be cut to MAX_STRATEGIC_ENEMY_GROUP_SIZE, see how many troops are allowed and reduce sector count accordingly
UINT8 greens = pSector->ubNumberOfCivsAtLevel[0];
UINT8 regulars = pSector->ubNumberOfCivsAtLevel[1];
UINT8 elites = pSector->ubNumberOfCivsAtLevel[2];
pSector->ubNumberOfCivsAtLevel[0] = 0;
pSector->ubNumberOfCivsAtLevel[1] = 0;
pSector->ubNumberOfCivsAtLevel[2] = 0;
pGroup = CreateNewMilitiaGroupDepartingFromSector( SECTOR( sBattleSectorX, sBattleSectorY ), greens, regulars, elites );
pSector->ubNumberOfCivsAtLevel[0] -= greens;
pSector->ubNumberOfCivsAtLevel[1] -= regulars;
pSector->ubNumberOfCivsAtLevel[2] -= elites;
// if we haven't found a good direction yet, we have to pick the best adjacent sector we can find
if ( !found )