Skip to content

Commit e731291

Browse files
committed
refactor: Remove superfluous global references in singleton classes
1 parent ce4e595 commit e731291

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

Core/GameEngine/Source/Common/System/FileSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,8 +421,8 @@ AsciiString FileSystem::normalizePath(const AsciiString& path)
421421
//============================================================================
422422
Bool FileSystem::isPathInDirectory(const AsciiString& testPath, const AsciiString& basePath)
423423
{
424-
AsciiString testPathNormalized = TheFileSystem->normalizePath(testPath);
425-
AsciiString basePathNormalized = TheFileSystem->normalizePath(basePath);
424+
AsciiString testPathNormalized = normalizePath(testPath);
425+
AsciiString basePathNormalized = normalizePath(basePath);
426426

427427
if (basePathNormalized.isEmpty())
428428
{

GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ SaveCode GameState::missionSave( void )
636636
desc.format( format, TheGameText->fetch( campaign->m_campaignNameLabel ).str(), missionNumber );
637637

638638
// do an automatic mission save
639-
return TheGameState->saveGame( "", desc, SAVE_FILE_TYPE_MISSION );
639+
return saveGame( "", desc, SAVE_FILE_TYPE_MISSION );
640640

641641
}
642642

GeneralsMD/Code/GameEngine/Source/GameClient/GameClient.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ void GameClient::preloadAssets( TimeOfDay timeOfDay )
11101110
draw->preloadAssets( timeOfDay );
11111111

11121112
// destroy the drawable
1113-
TheGameClient->destroyDrawable( draw );
1113+
destroyDrawable( draw );
11141114

11151115
}
11161116

@@ -1534,7 +1534,7 @@ void GameClient::xfer( Xfer *xfer )
15341534
const ThingTemplate* drawTemplate = draw->getTemplate();
15351535
if (drawTemplate->getFinalOverride() != thingTemplate->getFinalOverride())
15361536
{
1537-
TheGameClient->destroyDrawable( draw );
1537+
destroyDrawable( draw );
15381538
draw = TheThingFactory->newDrawable( thingTemplate );
15391539
TheGameLogic->bindObjectAndDrawable(object, draw);
15401540
}

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ Object *AI::findClosestEnemy( const Object *me, Real range, UnsignedInt qualifie
710710

711711
Real distSqr = ThePartitionManager->getDistanceSquared(me, theEnemy, FROM_BOUNDINGSPHERE_2D);
712712
Real dist = sqrt(distSqr);
713-
Int modifier = dist/TheAI->getAiData()->m_attackPriorityDistanceModifier;
713+
Int modifier = dist/getAiData()->m_attackPriorityDistanceModifier;
714714
Int modPriority = curPriority-modifier;
715715
if (modPriority < 1)
716716
modPriority = 1;

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,7 @@ WeaponStore::~WeaponStore()
15921592
//-------------------------------------------------------------------------------------------------
15931593
void WeaponStore::handleProjectileDetonation(const WeaponTemplate* wt, const Object *source, const Coord3D* pos, WeaponBonusConditionFlags extraBonusFlags, Bool inflictDamage )
15941594
{
1595-
Weapon* w = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON);
1595+
Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON);
15961596
w->loadAmmoNow(source);
15971597
w->fireProjectileDetonationWeapon( source, pos, extraBonusFlags, inflictDamage );
15981598
deleteInstance(w);
@@ -1603,7 +1603,7 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object
16031603
{
16041604
if (wt == NULL)
16051605
return;
1606-
Weapon* w = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON);
1606+
Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON);
16071607
w->loadAmmoNow(source);
16081608
w->fireWeapon(source, pos);
16091609
deleteInstance(w);
@@ -1615,7 +1615,7 @@ void WeaponStore::createAndFireTempWeapon(const WeaponTemplate* wt, const Object
16151615
//CRCDEBUG_LOG(("WeaponStore::createAndFireTempWeapon() for %s", DescribeObject(source)));
16161616
if (wt == NULL)
16171617
return;
1618-
Weapon* w = TheWeaponStore->allocateNewWeapon(wt, PRIMARY_WEAPON);
1618+
Weapon* w = allocateNewWeapon(wt, PRIMARY_WEAPON);
16191619
w->loadAmmoNow(source);
16201620
w->fireWeapon(source, target);
16211621
deleteInstance(w);

GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,8 +1702,8 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
17021702
Region3D extent;
17031703
TheTerrainLogic->getExtent( &extent );
17041704

1705-
TheGameLogic->setWidth( extent.hi.x - extent.lo.x );
1706-
TheGameLogic->setHeight( extent.hi.y - extent.lo.y );
1705+
setWidth( extent.hi.x - extent.lo.x );
1706+
setHeight( extent.hi.y - extent.lo.y );
17071707

17081708
// anytime the world's size changes, must reset the partition mgr
17091709
ThePartitionManager->init();
@@ -3060,7 +3060,7 @@ void GameLogic::popSleepyUpdate()
30603060
void GameLogic::friend_awakenUpdateModule(Object* obj, UpdateModulePtr u, UnsignedInt whenToWakeUp)
30613061
{
30623062
//USE_PERF_TIMER(friend_awakenUpdateModule)
3063-
UnsignedInt now = TheGameLogic->getFrame();
3063+
UnsignedInt now = getFrame();
30643064
DEBUG_ASSERTCRASH(whenToWakeUp >= now, ("setWakeFrame frame is in the past... are you sure this is what you want?"));
30653065

30663066
if (u == m_curUpdateModule)
@@ -3692,7 +3692,7 @@ void GameLogic::update( void )
36923692
}
36933693

36943694
// send the current time to the GameClient
3695-
UnsignedInt now = TheGameLogic->getFrame();
3695+
UnsignedInt now = getFrame();
36963696
TheGameClient->setFrame(now);
36973697

36983698
// update (execute) scripts
@@ -3888,7 +3888,7 @@ void GameLogic::preUpdate()
38883888
Bool pause = TRUE;
38893889
Bool pauseMusic = FALSE;
38903890
Bool pauseInput = FALSE;
3891-
TheGameLogic->setGamePaused(pause, pauseMusic, pauseInput);
3891+
setGamePaused(pause, pauseMusic, pauseInput);
38923892
}
38933893
}
38943894

@@ -3960,7 +3960,7 @@ void GameLogic::registerObject( Object *obj )
39603960
// add object to lookup table
39613961
addObjectToLookupTable( obj );
39623962

3963-
UnsignedInt now = TheGameLogic->getFrame();
3963+
UnsignedInt now = getFrame();
39643964
if (now == 0)
39653965
now = 1;
39663966
for (BehaviorModule** b = obj->getBehaviorModules(); *b; ++b)
@@ -5206,7 +5206,7 @@ void GameLogic::loadPostProcess( void )
52065206
#ifdef ALLOW_NONSLEEPY_UPDATES
52075207
m_normalUpdates.clear();
52085208
#else
5209-
UnsignedInt now = TheGameLogic->getFrame();
5209+
UnsignedInt now = getFrame();
52105210
if (now == 0)
52115211
now = 1;
52125212
#endif

0 commit comments

Comments
 (0)