From 3b4b76cf56c594e10d9d4770a2c2f81879042c7a Mon Sep 17 00:00:00 2001 From: Wanne Date: Tue, 7 Jul 2009 08:37:43 +0000 Subject: [PATCH] - Bugfix: At the end of an underground battle, all stationary enemy garrisons in the SURFACE sector directly above disappear completely (by Headrock & Wil473) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3087 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Overhead.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 4dd5a924b..7f71c1e9d 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -6203,14 +6203,26 @@ void DeathNoMessageTimerCallback( void ) } } -void RemoveStaticEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY ) +void RemoveStaticEnemiesFromSectorInfo( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) { - SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); + if (!bMapZ) // Battle ended Above-ground + { + SECTORINFO *pSectorInfo = &( SectorInfo[ SECTOR( sMapX, sMapY ) ] ); - pSectorInfo->ubNumAdmins = pSectorInfo->ubNumTroops = pSectorInfo->ubNumElites = 0; - pSectorInfo->ubAdminsInBattle = pSectorInfo->ubTroopsInBattle = pSectorInfo->ubElitesInBattle = 0; + pSectorInfo->ubNumAdmins = pSectorInfo->ubNumTroops = pSectorInfo->ubNumElites = 0; + pSectorInfo->ubAdminsInBattle = pSectorInfo->ubTroopsInBattle = pSectorInfo->ubElitesInBattle = 0; + } + else + { + UNDERGROUND_SECTORINFO *pSectorInfo; + + pSectorInfo = FindUnderGroundSector( sMapX, sMapY, bMapZ ); + pSectorInfo->ubNumAdmins = pSectorInfo->ubNumTroops = pSectorInfo->ubNumElites = 0; + pSectorInfo->ubAdminsInBattle = pSectorInfo->ubTroopsInBattle = pSectorInfo->ubElitesInBattle = 0; + } } + //!!!! //IMPORTANT NEW NOTE: //Whenever returning TRUE, make sure you clear gfBlitBattleSectorLocator; @@ -6371,7 +6383,7 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) } // Kill all enemies. Sometime even after killing all the enemies, there appeares "in battle" enemies in sector info - RemoveStaticEnemiesFromSectorInfo( gWorldSectorX, gWorldSectorY ); + RemoveStaticEnemiesFromSectorInfo( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); // If here, the battle has been won!