Wrap PBI status flags in accessors

gfPreBattleInterfaceActive and gfUsePersistantPBI are now file-static in
PreBattle Interface.cpp, reached only through Is/Set accessors declared in
the header. No behavior change: getters return BOOLEAN so ==TRUE/==FALSE
sites are untouched semantically.

Verify: grep 'gfPreBattleInterfaceActive\|gfUsePersistantPBI' across the tree
hits only the two static definitions, the four accessor bodies (all in
PreBattle Interface.cpp), and two commented-out Asserts in Strategic
Movement.cpp. Every other former site now calls an accessor. Build: JA2.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marco Antonio J. Costa
2026-08-02 14:58:24 -03:00
committed by majcosta
co-authored by Claude Opus 4.8
parent d683cdeb64
commit dbf6e1cd10
11 changed files with 68 additions and 64 deletions
+17 -11
View File
@@ -142,7 +142,7 @@ SOLDIERTYPE* UninvolvedSoldier( INT32 index );
MOUSE_REGION PBInterfaceBlanket;
BOOLEAN gfPreBattleInterfaceActive = FALSE;
static BOOLEAN gfPreBattleInterfaceActive = FALSE;
UINT32 iPBButton[3] = {0,0,0};
UINT32 iPBButtonImage[3] = {0,0,0};
// WDS Graphics bug die to uninitialized variable
@@ -208,7 +208,13 @@ extern UINT8 gubPBSectorZ = 0;
BOOLEAN gfCantRetreatInPBI = FALSE;
//SAVE END
BOOLEAN gfUsePersistantPBI = FALSE;
static BOOLEAN gfUsePersistantPBI = FALSE;
BOOLEAN IsPreBattleInterfaceActive() { return gfPreBattleInterfaceActive; }
void SetPreBattleInterfaceActive( BOOLEAN fActive ) { gfPreBattleInterfaceActive = fActive; }
BOOLEAN IsPersistantPBI() { return gfUsePersistantPBI; }
void SetPersistantPBI( BOOLEAN fPersistant ) { gfUsePersistantPBI = fPersistant; }
INT32 giHilitedInvolved = 0;
INT32 giHilitedUninvolved = 0;
@@ -314,7 +320,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
AbortMovementPlottingMode( );
}
if( gfPreBattleInterfaceActive )
if( IsPreBattleInterfaceActive() )
return;
//CHRISL: If for some reason we're not looking at a valid sector, leave the preBattleInterface.
@@ -361,7 +367,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
gpBattleGroup = pBattleGroup;
gfEnteringMapScreen = TRUE;
gfEnteringMapScreenToEnterPreBattleInterface = TRUE;
gfUsePersistantPBI = TRUE;
SetPersistantPBI( TRUE );
return;
}
#endif
@@ -375,7 +381,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
gpBattleGroup = pBattleGroup;
gfEnteringMapScreen = TRUE;
gfEnteringMapScreenToEnterPreBattleInterface = TRUE;
gfUsePersistantPBI = TRUE;
SetPersistantPBI( TRUE );
return;
}
@@ -585,7 +591,7 @@ void InitPreBattleInterface( GROUP *pBattleGroup, BOOLEAN fPersistantPBI )
gfPBButtonsHidden = TRUE;
// ARM: this must now be set before any calls utilizing the GetCurrentBattleSectorXYZ() function
gfPreBattleInterfaceActive = TRUE;
SetPreBattleInterfaceActive( TRUE );
CheckForRobotAndIfItsControlled();
@@ -1211,7 +1217,7 @@ void ScrollPreBattleInterface( BOOLEAN fUp )
void KillPreBattleInterface()
{
if( !gfPreBattleInterfaceActive )
if( !IsPreBattleInterfaceActive() )
return;
fDisableMapInterfaceDueToBattle = FALSE;
@@ -1234,7 +1240,7 @@ void KillPreBattleInterface()
MSYS_RemoveRegion( &UninvolvedRegion );
*/
gfPreBattleInterfaceActive = FALSE;
SetPreBattleInterfaceActive( FALSE );
//UpdateCharRegionHelpText( );
@@ -2685,17 +2691,17 @@ void HandlePreBattleInterfaceStates()
if( gfEnteringMapScreenToEnterPreBattleInterface && !gfEnteringMapScreen )
{
gfEnteringMapScreenToEnterPreBattleInterface = FALSE;
if( !gfUsePersistantPBI )
if( !IsPersistantPBI() )
{
InitPreBattleInterface( NULL, FALSE );
gfUsePersistantPBI = TRUE;
SetPersistantPBI( TRUE );
}
else
{
InitPreBattleInterface( gpBattleGroup, TRUE );
}
}
else if( gfDelayAutoResolveStart && gfPreBattleInterfaceActive )
else if( gfDelayAutoResolveStart && IsPreBattleInterfaceActive() )
{
gfDelayAutoResolveStart = FALSE;
gfAutomaticallyStartAutoResolve = TRUE;