From 8a84db40d4c1830a59a0bb2f8d1df203799afca0 Mon Sep 17 00:00:00 2001 From: Flugente Date: Tue, 18 Aug 2015 19:26:41 +0000 Subject: [PATCH] Fix: enemy tanks spawned by cheats are not added to the sector count git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7980 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Strategic/Map Screen Interface Map.cpp | 28 +++++++++++++++++--------- Tactical/Handle UI.cpp | 8 +++++--- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Strategic/Map Screen Interface Map.cpp b/Strategic/Map Screen Interface Map.cpp index 3e830ad1..04cf2dca 100644 --- a/Strategic/Map Screen Interface Map.cpp +++ b/Strategic/Map Screen Interface Map.cpp @@ -6588,10 +6588,7 @@ void HandleShowingOfEnemyForcesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bS // nope - display nothing return; }*/ - - // Flugente: tanks get a special icon, so we need to count them separately - UINT16 usNumTanks = NumTanksInSector( sSectorX, sSectorY, ENEMY_TEAM ); - + switch ( WhatPlayerKnowsAboutEnemiesInSector( sSectorX, sSectorY ) ) { // HEADROCK HAM 5: New cases below for showing enemy group heading. @@ -6612,16 +6609,27 @@ void HandleShowingOfEnemyForcesInSector( INT16 sSectorX, INT16 sSectorY, INT8 bS break; case KNOWS_HOW_MANY: - // display individual icons for each enemy, starting at the received icon position index - ShowEnemiesInSector( sSectorX, sSectorY, sNumberOfEnemies, usNumTanks, ubIconPosition ); + { + // Flugente: tanks get a special icon, so we need to count them separately + UINT16 usNumTanks = NumTanksInSector( sSectorX, sSectorY, ENEMY_TEAM ); + + // display individual icons for each enemy, starting at the received icon position index + ShowEnemiesInSector( sSectorX, sSectorY, sNumberOfEnemies, usNumTanks, ubIconPosition ); + } break; // HEADROCK HAM 5: New case for showing enemy groups AND where the are headed. case KNOWS_HOW_MANY_AND_WHERE_GOING: - // display individual icons for each enemy, starting at the received icon position index - ShowEnemiesInSector( sSectorX, sSectorY, sNumberOfEnemies, usNumTanks, ubIconPosition ); - // display their direction of movement, if valid. - ShowNonPlayerGroupsInMotion( sSectorX, sSectorY, ENEMY_TEAM ); + { + // Flugente: tanks get a special icon, so we need to count them separately + UINT16 usNumTanks = NumTanksInSector( sSectorX, sSectorY, ENEMY_TEAM ); + + // display individual icons for each enemy, starting at the received icon position index + ShowEnemiesInSector( sSectorX, sSectorY, sNumberOfEnemies, usNumTanks, ubIconPosition ); + + // display their direction of movement, if valid. + ShowNonPlayerGroupsInMotion( sSectorX, sSectorY, ENEMY_TEAM ); + } break; } } diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index 2fc1af91..93691197 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -1174,9 +1174,10 @@ UINT32 UIHandleNewBadMerc( UI_EVENT *pUIEvent ) SECTORINFO *pSector = &SectorInfo[ SECTOR( gWorldSectorX, gWorldSectorY ) ]; switch( pSoldier->ubSoldierClass ) { - case SOLDIER_CLASS_ADMINISTRATOR: pSector->ubNumAdmins++; pSector->ubAdminsInBattle++; break; - case SOLDIER_CLASS_ARMY: pSector->ubNumTroops++; pSector->ubTroopsInBattle++; break; - case SOLDIER_CLASS_ELITE: pSector->ubNumElites++; pSector->ubElitesInBattle++; break; + case SOLDIER_CLASS_ADMINISTRATOR: pSector->ubNumAdmins++; pSector->ubAdminsInBattle++; break; + case SOLDIER_CLASS_ARMY: pSector->ubNumTroops++; pSector->ubTroopsInBattle++; break; + case SOLDIER_CLASS_ELITE: pSector->ubNumElites++; pSector->ubElitesInBattle++; break; + case SOLDIER_CLASS_TANK: pSector->ubNumTanks++; pSector->ubTanksInBattle++; break; } } else @@ -1189,6 +1190,7 @@ UINT32 UIHandleNewBadMerc( UI_EVENT *pUIEvent ) case SOLDIER_CLASS_ADMINISTRATOR: pSector->ubNumAdmins++; pSector->ubAdminsInBattle++; break; case SOLDIER_CLASS_ARMY: pSector->ubNumTroops++; pSector->ubTroopsInBattle++; break; case SOLDIER_CLASS_ELITE: pSector->ubNumElites++; pSector->ubElitesInBattle++; break; + case SOLDIER_CLASS_TANK: pSector->ubNumTanks++; pSector->ubTanksInBattle++; break; } } }