Skip to content

Commit b878990

Browse files
authored
refactor: Apply clang-tidy fixes for generals-use-this-instead-of-singleton (#2017)
1 parent 646e3dd commit b878990

File tree

49 files changed

+487
-487
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+487
-487
lines changed

Core/GameEngine/Source/GameNetwork/FirewallHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ void FirewallHelperClass::writeFirewallBehavior(void)
508508
numstr = num;
509509
(pref)["FirewallBehavior"] = numstr;
510510

511-
TheWritableGlobalData->m_firewallPortAllocationDelta = TheFirewallHelper->getSourcePortAllocationDelta();
511+
TheWritableGlobalData->m_firewallPortAllocationDelta = getSourcePortAllocationDelta();
512512
num[0] = 0;
513513
itoa(TheGlobalData->m_firewallPortAllocationDelta, num, 10);
514514
numstr = num;

Core/GameEngine/Source/GameNetwork/GameSpy/StagingRoomGameInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ void GameSpyStagingRoom::launchGame( void )
844844
// shutdown the top, but do not pop it off the stack
845845
// TheShell->hideShell();
846846
// setup the Global Data with the Map and Seed
847-
TheWritableGlobalData->m_pendingFile = TheGameSpyGame->getMap();
847+
TheWritableGlobalData->m_pendingFile = getMap();
848848

849849
// send a message to the logic for a new game
850850
GameMessage *msg = TheMessageStream->appendMessage( GameMessage::MSG_NEW_GAME );
@@ -861,7 +861,7 @@ void GameSpyStagingRoom::launchGame( void )
861861
req.buddyRequestType = BuddyRequest::BUDDYREQUEST_SETSTATUS;
862862
req.arg.status.status = GP_PLAYING;
863863
strcpy(req.arg.status.statusString, "Loading");
864-
sprintf(req.arg.status.locationString, "%s", WideCharStringToMultiByte(TheGameSpyGame->getGameName().str()).c_str());
864+
sprintf(req.arg.status.locationString, "%s", WideCharStringToMultiByte(getGameName().str()).c_str());
865865
TheGameSpyBuddyMessageQueue->addRequest(req);
866866

867867
delete TheNAT;

Core/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ void LANAPI::handleInActive(LANMessage *msg, UnsignedInt senderIP) {
709709
}
710710

711711
// don't want to unaccept the host, that's silly. They can't hit start alt-tabbed anyways.
712-
if (senderIP == TheLAN->GetLocalIP()) {
712+
if (senderIP == GetLocalIP()) {
713713
return;
714714
}
715715

Core/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWaterTracks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,7 @@ void WaterTracksRenderSystem::loadTracks(void)
10231023
goto tryagain;
10241024
}
10251025

1026-
umod=TheWaterTracksRenderSystem->bindTrack(wtype);
1026+
umod=bindTrack(wtype);
10271027
if (umod)
10281028
{ //umod->init(1.5f*MAP_XY_FACTOR,Vector2(0,0),Vector2(1,1),"wave256.tga");
10291029
flipU ^= 1; //toggle flip state
@@ -1032,7 +1032,7 @@ void WaterTracksRenderSystem::loadTracks(void)
10321032

10331033
if (waveTypeInfo[wtype].m_secondWaveTimeOffset) //check if we need a second wave to follow
10341034
{
1035-
umod=TheWaterTracksRenderSystem->bindTrack(wtype);
1035+
umod=bindTrack(wtype);
10361036
if (umod)
10371037
{
10381038
umod->init(waveTypeInfo[wtype].m_finalHeight,waveTypeInfo[wtype].m_finalWidth,startPos,endPos,waveTypeInfo[wtype].m_textureName,waveTypeInfo[wtype].m_secondWaveTimeOffset);

Core/Tools/ImagePacker/Source/ImagePacker.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ Bool ImagePacker::validateImages( void )
179179

180180
proceed = DialogBox( ApplicationHInstance,
181181
(LPCTSTR)IMAGE_ERRORS,
182-
TheImagePacker->getWindowHandle(),
182+
getWindowHandle(),
183183
(DLGPROC)ImageErrorProc );
184184

185185
}
@@ -317,7 +317,7 @@ void ImagePacker::writeFinalTextures( void )
317317

318318
DialogBox( ApplicationHInstance,
319319
(LPCTSTR)PAGE_ERRORS,
320-
TheImagePacker->getWindowHandle(),
320+
getWindowHandle(),
321321
(DLGPROC)PageErrorProc );
322322

323323
}
@@ -998,33 +998,33 @@ Bool ImagePacker::getSettingsFromDialog( HWND dialog )
998998
Bool outputAlpha = FALSE;
999999
if( IsDlgButtonChecked( dialog, CHECK_ALPHA ) == BST_CHECKED )
10001000
outputAlpha = TRUE;
1001-
TheImagePacker->setOutputAlpha( outputAlpha );
1001+
setOutputAlpha( outputAlpha );
10021002

10031003
// get create INI option
10041004
Bool createINI = FALSE;
10051005
if( IsDlgButtonChecked( dialog, CHECK_INI ) == BST_CHECKED )
10061006
createINI = TRUE;
1007-
TheImagePacker->setINICreate( createINI );
1007+
setINICreate( createINI );
10081008

10091009
// get preview with image option
10101010
Bool useBitmap = FALSE;
10111011
if( IsDlgButtonChecked( dialog, CHECK_BITMAP_PREVIEW ) == BST_CHECKED )
10121012
useBitmap = TRUE;
1013-
TheImagePacker->setUseTexturePreview( useBitmap );
1013+
setUseTexturePreview( useBitmap );
10141014

10151015
// get option to compress final textures
10161016
Bool compress = FALSE;
10171017
if( IsDlgButtonChecked( dialog, CHECK_COMPRESS ) == BST_CHECKED )
10181018
compress = TRUE;
1019-
TheImagePacker->setCompressTextures( compress );
1019+
setCompressTextures( compress );
10201020

10211021
// get options for the gap options
1022-
TheImagePacker->clearGapMethod( ImagePacker::GAP_METHOD_EXTEND_RGB );
1022+
clearGapMethod( ImagePacker::GAP_METHOD_EXTEND_RGB );
10231023
if( IsDlgButtonChecked( dialog, CHECK_GAP_EXTEND_RGB ) == BST_CHECKED )
1024-
TheImagePacker->setGapMethod( ImagePacker::GAP_METHOD_EXTEND_RGB );
1025-
TheImagePacker->clearGapMethod( ImagePacker::GAP_METHOD_GUTTER );
1024+
setGapMethod( ImagePacker::GAP_METHOD_EXTEND_RGB );
1025+
clearGapMethod( ImagePacker::GAP_METHOD_GUTTER );
10261026
if( IsDlgButtonChecked( dialog, CHECK_GAP_GUTTER ) == BST_CHECKED )
1027-
TheImagePacker->setGapMethod( ImagePacker::GAP_METHOD_GUTTER );
1027+
setGapMethod( ImagePacker::GAP_METHOD_GUTTER );
10281028

10291029
// get gutter size whether we are using that option or not
10301030
Int gutter = GetDlgItemInt( dialog, EDIT_GUTTER, NULL, FALSE );

Generals/Code/GameEngine/Include/GameLogic/PartitionManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot
13211321
void getCellCenterPos(Int x, Int y, Real& xx, Real& yy);
13221322

13231323
// find the cell that covers the world coords (wx,wy) and return its coords.
1324-
void worldToCell(Real wx, Real wy, Int *cx, Int *cy);
1324+
void worldToCell(Real wx, Real wy, Int *cx, Int *cy) const;
13251325

13261326
// given a distance in world coords, return the number of cells needed to cover that distance (rounding up)
13271327
Int worldToCellDist(Real w);
@@ -1494,7 +1494,7 @@ class PartitionManager : public SubsystemInterface, public Snapshot
14941494
};
14951495

14961496
// -----------------------------------------------------------------------------
1497-
inline void PartitionManager::worldToCell(Real wx, Real wy, Int *cx, Int *cy)
1497+
inline void PartitionManager::worldToCell(Real wx, Real wy, Int *cx, Int *cy) const
14981498
{
14991499
*cx = REAL_TO_INT_FLOOR((wx - m_worldExtents.lo.x) * m_cellSizeInv);
15001500
*cy = REAL_TO_INT_FLOOR((wy - m_worldExtents.lo.y) * m_cellSizeInv);

Generals/Code/GameEngine/Source/Common/GlobalData.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,7 @@ void GlobalData::reset( void )
11181118
{
11191119

11201120
// get next instance
1121-
GlobalData* next = TheWritableGlobalData->m_next;
1121+
GlobalData* next = m_next;
11221122

11231123
// delete the head of the global data list (the latest override)
11241124
delete TheWritableGlobalData;

Generals/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

Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ void ControlBar::populatePurchaseScience( Player* player )
188188
player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3().isEmpty() ||
189189
player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8().isEmpty())
190190
return;
191-
commandSet1 = TheControlBar->findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank1()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING
192-
commandSet3 = TheControlBar->findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING
193-
commandSet8 = TheControlBar->findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING
191+
commandSet1 = findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank1()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING
192+
commandSet3 = findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank3()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING
193+
commandSet8 = findCommandSet(player->getPlayerTemplate()->getPurchaseScienceCommandSetRank8()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING
194194

195195
for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_1; i++ )
196196
m_sciencePurchaseWindowsRank1[i]->winHide(TRUE);
@@ -2712,7 +2712,7 @@ void ControlBar::showRallyPoint(const Coord3D* loc)
27122712
marker->setOrientation(TheGlobalData->m_downwindAngle); // To blow down wind -- ML
27132713

27142714
// set the marker colors to that of the local player
2715-
Player* player = TheControlBar->getCurrentlyViewedPlayer();
2715+
Player* player = getCurrentlyViewedPlayer();
27162716
if (player)
27172717
{
27182718
if (TheGlobalData->m_timeOfDay == TIME_OF_DAY_NIGHT)
@@ -3258,7 +3258,7 @@ void ControlBar::populateSpecialPowerShortcut( Player *player)
32583258
// get command set
32593259
if(player->getPlayerTemplate()->getSpecialPowerShortcutCommandSet().isEmpty() )
32603260
return;
3261-
commandSet = TheControlBar->findCommandSet(player->getPlayerTemplate()->getSpecialPowerShortcutCommandSet()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING
3261+
commandSet = findCommandSet(player->getPlayerTemplate()->getSpecialPowerShortcutCommandSet()); // TEMP WILL CHANGE TO PROPER WAY ONCE WORKING
32623262
if(!commandSet)
32633263
return;
32643264
// populate the button with commands defined

Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ void ControlBar::populateCommand( Object *obj )
270270
resetBuildQueueData();
271271

272272
// get command set
273-
commandSet = TheControlBar->findCommandSet( obj->getCommandSetString() );
273+
commandSet = findCommandSet( obj->getCommandSetString() );
274274

275275
// if no command set match is found hide all the buttons
276276
if( commandSet == NULL )

0 commit comments

Comments
 (0)