Fix (by navaroe): The game could try to place more soldiers on the map than the map had slots which would cause the game to crash.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7955 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2015-08-02 13:59:07 +00:00
parent 0c27f5f2c4
commit abe7117231
+2 -1
View File
@@ -656,6 +656,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
if (mapMaximumNumberOfEnemies > gGameExternalOptions.ubGameMaximumNumberOfEnemies)
mapMaximumNumberOfEnemies = gGameExternalOptions.ubGameMaximumNumberOfEnemies;
//are there more enemies in the sector then we can actually place on map?
gfPendingNonPlayerTeam[ENEMY_TEAM] = (NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) > mapMaximumNumberOfEnemies);
pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ];
@@ -881,7 +882,7 @@ BOOLEAN PrepareEnemyForSectorBattle()
//sNumSlots = mapMaximumNumberOfEnemies - totalCountOfStationaryEnemies;
// Flugente: at this point, soldiers have already been placed, thus enough slots for them exist
sNumSlots = max( mapMaximumNumberOfEnemies, NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) );
sNumSlots = min( mapMaximumNumberOfEnemies, NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ) );
pGroup = gpGroupList;
while( pGroup && sNumSlots > 0 )