From 6c33009fab63e010b6bd309dbd84fd9b31748875 Mon Sep 17 00:00:00 2001 From: Asdow <20314541+Asdow@users.noreply.github.com> Date: Mon, 11 Nov 2024 00:14:51 +0200 Subject: [PATCH] Remove bLastKnownEnemies from SECTORINFO As per the old comment, even though the field value is updated partially according to whether there are known enemies present or not, it's not used for anything. --- Strategic/Auto Resolve.cpp | 2 -- Strategic/Campaign Types.h | 3 --- Strategic/PreBattle Interface.cpp | 4 ---- Strategic/Queen Command.cpp | 17 ----------------- Strategic/Strategic Movement.cpp | 23 ----------------------- Tactical/Overhead.cpp | 5 ----- 6 files changed, 54 deletions(-) diff --git a/Strategic/Auto Resolve.cpp b/Strategic/Auto Resolve.cpp index 5a1cb23a..2d833ef6 100644 --- a/Strategic/Auto Resolve.cpp +++ b/Strategic/Auto Resolve.cpp @@ -460,7 +460,6 @@ void EliminateAllEnemies( UINT8 ubSectorX, UINT8 ubSectorY ) pSector->ubNumJeeps = 0; pSector->ubNumRobots = 0; pSector->ubNumCreatures = 0; - pSector->bLastKnownEnemies = 0; //Remove the mobile forces here, but only if battle is over. while( pGroup ) { @@ -1839,7 +1838,6 @@ void RenderAutoResolve() HandleMoraleEvent( NULL, MORALE_BATTLE_WON, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); if( ProcessLoyalty() )HandleGlobalLoyaltyEvent( GLOBAL_LOYALTY_BATTLE_WON, gpAR->ubSectorX, gpAR->ubSectorY, 0 ); - SectorInfo[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].bLastKnownEnemies = 0; SetThisSectorAsPlayerControlled( gpAR->ubSectorX, gpAR->ubSectorY, 0, TRUE ); #ifdef NEWMUSIC GlobalSoundID = MusicSoundValues[ SECTOR( gpAR->ubSectorX, gpAR->ubSectorY ) ].SoundTacticalVictory[0]; diff --git a/Strategic/Campaign Types.h b/Strategic/Campaign Types.h index f5b6d996..2c490fcb 100644 --- a/Strategic/Campaign Types.h +++ b/Strategic/Campaign Types.h @@ -500,9 +500,6 @@ typedef struct SECTORINFO UINT16 ubNumCreatures; //only set when immediately before ground attack made! UINT16 ubTroopsInBattle, ubElitesInBattle, ubAdminsInBattle, ubCreaturesInBattle; - INT8 bLastKnownEnemies; // -1 means never been there, no idea, otherwise it's what we'd observed most recently - // while this is being maintained (partially, surely buggy), nothing uses it anymore. ARM - UINT32 ubDayOfLastCreatureAttack; UINT32 uiFacilitiesFlags; // the flags for various facilities diff --git a/Strategic/PreBattle Interface.cpp b/Strategic/PreBattle Interface.cpp index effe444f..36fd826a 100644 --- a/Strategic/PreBattle Interface.cpp +++ b/Strategic/PreBattle Interface.cpp @@ -407,8 +407,6 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI ) gubPBSectorY = gpBattleGroup->ubSectorY; gubPBSectorZ = gpBattleGroup->ubSectorZ; - // get number of enemies thought to be here - SectorInfo[SECTOR( gubPBSectorX, gubPBSectorY )].bLastKnownEnemies = NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM ); fMapPanelDirty = TRUE; } else if( gfPersistantPBI ) @@ -1547,14 +1545,12 @@ void RenderPreBattleInterface() { // don't know how many swprintf( str, L"?" ); - SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ].bLastKnownEnemies = -2; } else { // know exactly how many i = NumNonPlayerTeamMembersInSector( gubPBSectorX, gubPBSectorY, ENEMY_TEAM ); swprintf( str, L"%d", i ); - SectorInfo[ SECTOR( gubPBSectorX, gubPBSectorY ) ].bLastKnownEnemies = (INT8)i; } x = 57 + (27 - StringPixLength( str, FONT14ARIAL )) / 2; y = 36; diff --git a/Strategic/Queen Command.cpp b/Strategic/Queen Command.cpp index 58452a63..23bddfc8 100644 --- a/Strategic/Queen Command.cpp +++ b/Strategic/Queen Command.cpp @@ -1190,7 +1190,6 @@ BOOLEAN PrepareEnemyForUndergroundBattle() //The queen AI layer must process the event by subtracting forces, etc. void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) { - INT32 iNumEnemiesInSector; SECTORINFO *pSector; INT32 iMaxEnemyGroupSize = gGameExternalOptions.iMaxEnemyGroupSize; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"QueenCommand"); @@ -1737,22 +1736,6 @@ void ProcessQueenCmdImplicationsOfDeath( SOLDIERTYPE *pSoldier ) } } } - if( !pSoldier->bSectorZ ) - { - pSector = &SectorInfo[ SECTOR( pSoldier->sSectorX, pSoldier->sSectorY ) ]; - iNumEnemiesInSector = NumNonPlayerTeamMembersInSector( pSoldier->sSectorX, pSoldier->sSectorY, ENEMY_TEAM ); - if( iNumEnemiesInSector ) - { - if( pSector->bLastKnownEnemies >= 0 ) - { - pSector->bLastKnownEnemies = (INT8)iNumEnemiesInSector; - } - } - else - { - pSector->bLastKnownEnemies = 0; - } - } } //Well, not so rarely with mobile reinforcements! diff --git a/Strategic/Strategic Movement.cpp b/Strategic/Strategic Movement.cpp index 588f91c1..323f9100 100644 --- a/Strategic/Strategic Movement.cpp +++ b/Strategic/Strategic Movement.cpp @@ -1946,11 +1946,6 @@ void GroupArrivedAtSector( UINT8 ubGroupID, BOOLEAN fCheckForBattle, BOOLEAN fNe if ( pGroup->usGroupTeam == OUR_TEAM ) { - if( pGroup->ubSectorZ == 0 ) - { - SectorInfo[SECTOR( pGroup->ubSectorX, pGroup->ubSectorY )].bLastKnownEnemies = NumNonPlayerTeamMembersInSector( pGroup->ubSectorX, pGroup->ubSectorY, ENEMY_TEAM ); - } - // Flugente: do not award experience gain if we never left if (!fNeverLeft) { @@ -3769,8 +3764,6 @@ INT32 GetTravelTimeForFootTeam( UINT8 ubSector, UINT8 ubDirection ) void HandleArrivalOfReinforcements( GROUP *pGroup ) { SOLDIERTYPE *pSoldier; - SECTORINFO *pSector; - INT32 iNumEnemiesInSector; INT32 cnt; if ( pGroup->usGroupTeam == OUR_TEAM ) @@ -3834,22 +3827,6 @@ void HandleArrivalOfReinforcements( GROUP *pGroup ) gfPendingNonPlayerTeam[MILITIA_TEAM] = TRUE; AddPossiblePendingMilitiaToBattle( ); } - - //Update the known number of enemies in the sector. - pSector = &SectorInfo[ SECTOR( pGroup->ubSectorX, pGroup->ubSectorY ) ]; - iNumEnemiesInSector = NumNonPlayerTeamMembersInSector( pGroup->ubSectorX, pGroup->ubSectorY, ENEMY_TEAM ); - if( iNumEnemiesInSector ) - { - if( pSector->bLastKnownEnemies >= 0 ) - { - pSector->bLastKnownEnemies = (INT8)iNumEnemiesInSector; - } - //if we don't know how many enemies there are, then we can't update this value. - } - else - { - pSector->bLastKnownEnemies = 0; - } } BOOLEAN PlayersBetweenTheseSectors( INT16 sSource, INT16 sDest, INT32 *iCountEnter, INT32 *iCountExit, BOOLEAN *fAboutToArriveEnter ) diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 84fbb739..5aa32012 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -7520,11 +7520,6 @@ BOOLEAN CheckForEndOfBattle( BOOLEAN fAnEnemyRetreated ) if ( fBattleLost || fBattleWon ) { - if( !gbWorldSectorZ ) - { - SectorInfo[SECTOR( gWorldSectorX, gWorldSectorY )].bLastKnownEnemies = NumNonPlayerTeamMembersInSector( gWorldSectorX, gWorldSectorY, ENEMY_TEAM ); - } - // Flugente: note number of wounded for campaign stats UpdateWoundedFromSectorInfo( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); }