Fix for missing enemies in mobile group when player invades

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1170 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-08-07 10:03:05 +00:00
parent 6de05c3fe1
commit 30bccc0d73
+5 -11
View File
@@ -137,7 +137,7 @@ UINT8 NumHostilesInSector( INT16 sSectorX, INT16 sSectorY, INT16 sSectorZ )
pGroup = gpGroupList;
while( pGroup )
{
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY )
if( !pGroup->fPlayer && !pGroup->fVehicle && pGroup->ubSectorX == sSectorX && pGroup->ubSectorY == sSectorY)
{
ubNumHostiles += pGroup->ubGroupSize;
}
@@ -537,9 +537,10 @@ BOOLEAN PrepareEnemyForSectorBattle()
ubTotalTroops = (UINT8)(pSector->ubNumTroops - pSector->ubTroopsInBattle);
ubTotalElites = (UINT8)(pSector->ubNumElites - pSector->ubElitesInBattle);
}
ubStationaryEnemies = (UINT8)(ubTotalAdmins + ubTotalTroops + ubTotalElites);
if( ubTotalAdmins + ubTotalTroops + ubTotalElites > 32 )
if( ubStationaryEnemies > 32 )
{
#ifdef JA2BETAVERSION
ScreenMsg( FONT_RED, MSG_ERROR, L"The total stationary enemy forces in sector %c%d is %d. (max %d)",
@@ -578,24 +579,20 @@ BOOLEAN PrepareEnemyForSectorBattle()
ubTotalAdmins, ubTotalTroops, ubTotalElites );
#endif
}
#if 0
// 0verhaul: Not here. First this gives reinforcement groups the unfair advantage of being already placed.
// Second, this particular loop is also used to reset strategic player groups in the sector so that they
// can be given movement orders (why here though?), but would quit early if the enemy slots are filled.
//Subtract the total number of stationary enemies from the available slots, as stationary forces take
//precendence in combat. The mobile forces that could also be in the same sector are considered later if
//all the slots fill up.
sNumSlots -= ubTotalAdmins + ubTotalTroops + ubTotalElites;
//Now, process all of the groups and search for both enemy and player groups in the sector.
//For enemy groups, we fill up the slots until we have none left or all of the groups have been
//processed.
#endif
for( pGroup = gpGroupList;
pGroup;
pGroup = pGroup->next)
{
#if 0
if( !pGroup->fPlayer && !pGroup->fVehicle &&
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
{ //Process enemy group in sector.
@@ -641,7 +638,6 @@ BOOLEAN PrepareEnemyForSectorBattle()
//NOTE:
//no provisions for profile troop leader or retreat groups yet.
}
#endif
if( pGroup->fPlayer && !pGroup->fVehicle && !pGroup->fBetweenSectors &&
pGroup->ubSectorX == gWorldSectorX && pGroup->ubSectorY == gWorldSectorY && !gbWorldSectorZ )
@@ -667,7 +663,6 @@ BOOLEAN PrepareEnemyForSectorBattle()
AddSoldierInitListEnemyDefenceSoldiers( ubTotalAdmins, ubTotalTroops, ubTotalElites );
#if 0
//Now, we have to go through all of the enemies in the new map, and assign their respective groups if
//in a mobile group, but only for the ones that were assigned from the
sNumSlots = 32 - ubStationaryEnemies;
@@ -728,7 +723,6 @@ BOOLEAN PrepareEnemyForSectorBattle()
}
pGroup = pGroup->next;
}
#endif
ValidateEnemiesHaveWeapons();