From f0b9bb43044ae66a1039b0d8b2d2e635309751a2 Mon Sep 17 00:00:00 2001 From: Flugente Date: Sat, 23 Apr 2016 14:36:38 +0000 Subject: [PATCH] Fix: if an enemy jeep is destroyed, sector jeep count is not properly updated git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8168 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Queen Command.cpp | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 0dcf41c91..0486ad2d7 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -1007,7 +1007,7 @@ BOOLEAN PrepareEnemyForSectorBattle() } break; case SOLDIER_CLASS_JEEP: - if ( ubNumTanks ) + if ( ubNumJeeps ) { num--; sNumSlots--; @@ -1180,6 +1180,35 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) } } break; + + case COMBAT_JEEP_CAR: + if ( !pSoldier->bSectorZ ) + { + pSector = &SectorInfo[SECTOR( pSoldier->sSectorX, pSoldier->sSectorY )]; + if ( pSector->ubNumJeeps ) + { + pSector->ubNumJeeps--; + } + if ( pSector->ubJeepsInBattle ) + { + pSector->ubJeepsInBattle--; + } + } + else + { + UNDERGROUND_SECTORINFO *pUnderground; + pUnderground = FindUnderGroundSector( (UINT8)pSoldier->sSectorX, (UINT8)pSoldier->sSectorY, (UINT8)pSoldier->bSectorZ ); + Assert( pUnderground ); + if ( pUnderground->ubNumJeeps ) + { + pUnderground->ubNumJeeps--; + } + if ( pUnderground->ubJeepsInBattle ) + { + pUnderground->ubJeepsInBattle--; + } + } + break; } if( pSoldier->aiData.bNeutral || pSoldier->bTeam != ENEMY_TEAM && pSoldier->bTeam != CREATURE_TEAM ) @@ -1333,7 +1362,7 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) // } #ifdef JA2BETAVERSION - ubTotalEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks; + ubTotalEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks + pSector->ubNumJeeps; #endif switch( pSoldier->ubSoldierClass ) @@ -1446,7 +1475,7 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) { //basement level (UNDERGROUND_SECTORINFO) UNDERGROUND_SECTORINFO *pSector = FindUnderGroundSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); #ifdef JA2BETAVERSION - UINT32 ubTotalEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks; + UINT32 ubTotalEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites + pSector->ubNumTanks + pSector->ubNumJeeps; #endif if( pSector ) {