Skip to content

Commit df16683

Browse files
committed
refactor(generalsMD): modernize NULL to nullptr
1 parent 1e459b2 commit df16683

File tree

189 files changed

+3496
-3496
lines changed

Some content is hidden

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

189 files changed

+3496
-3496
lines changed

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

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -145,14 +145,14 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co
145145
//static const CommandButton *exitCommand = findCommandButton( "Command_TransportExit" );
146146

147147
// sanity
148-
if( transport == NULL || commandSet == NULL )
148+
if( transport == nullptr || commandSet == nullptr )
149149
return;
150150

151151
// get the transport contain module
152152
ContainModuleInterface *contain = transport->getContain();
153153

154154
// sanity
155-
if( contain == NULL )
155+
if( contain == nullptr )
156156
return;
157157

158158
// how many slots do we have inside the transport
@@ -202,7 +202,7 @@ void ControlBar::doTransportInventoryUI( Object *transport, const CommandSet *co
202202
m_commandWindows[ i ]->winEnable( FALSE );
203203

204204
//Clear any potential veterancy rank, or else we'll see it when it's empty!
205-
GadgetButtonDrawOverlayImage( m_commandWindows[ i ], NULL );
205+
GadgetButtonDrawOverlayImage( m_commandWindows[ i ], nullptr );
206206

207207
//Unmanned vehicles don't have any commands available -- in fact they are hidden!
208208
if( transport->isDisabledByType( DISABLED_UNMANNED ) )
@@ -274,7 +274,7 @@ void ControlBar::populateCommand( Object *obj )
274274
commandSet = TheControlBar->findCommandSet( obj->getCommandSetString() );
275275

276276
// if no command set match is found hide all the buttons
277-
if( commandSet == NULL )
277+
if( commandSet == nullptr )
278278
{
279279

280280
// hide all the buttons
@@ -304,7 +304,7 @@ void ControlBar::populateCommand( Object *obj )
304304
commandButton = commandSet->getCommandButton(i);
305305

306306
// if button is not present, just hide the window
307-
if( commandButton == NULL )
307+
if( commandButton == nullptr )
308308
{
309309

310310
// hide window on interface
@@ -515,7 +515,7 @@ void ControlBar::resetContainData( void )
515515
for( i = 0; i < MAX_COMMANDS_PER_SET; i++ )
516516
{
517517

518-
m_containData[ i ].control = NULL;
518+
m_containData[ i ].control = nullptr;
519519
m_containData[ i ].objectID = INVALID_ID;
520520

521521
}
@@ -532,10 +532,10 @@ void ControlBar::resetBuildQueueData( void )
532532
for( i = 0; i < MAX_BUILD_QUEUE_BUTTONS; i++ )
533533
{
534534

535-
m_queueData[ i ].control = NULL;
535+
m_queueData[ i ].control = nullptr;
536536
m_queueData[ i ].type = PRODUCTION_INVALID;
537537
m_queueData[ i ].productionID = PRODUCTIONID_INVALID;
538-
m_queueData[ i ].upgradeToResearch = NULL;
538+
m_queueData[ i ].upgradeToResearch = nullptr;
539539

540540
}
541541

@@ -592,13 +592,13 @@ void ControlBar::populateBuildQueue( Object *producer )
592592
GadgetButtonSetText( m_queueData[ i ].control, L"" );
593593

594594
//Clear any potential veterancy rank, or else we'll see it when it's empty!
595-
GadgetButtonDrawOverlayImage( m_queueData[ i ].control, NULL );
595+
GadgetButtonDrawOverlayImage( m_queueData[ i ].control, nullptr );
596596

597597
}
598598

599599
// step through each object being built and set the image data for the buttons
600600
ProductionUpdateInterface *pu = producer->getProductionUpdateInterface();
601-
if( pu == NULL )
601+
if( pu == nullptr )
602602
return; // sanity
603603
const ProductionEntry *production;
604604
Int windowIndex = 0;
@@ -692,7 +692,7 @@ void ControlBar::populateBuildQueue( Object *producer )
692692
//-------------------------------------------------------------------------------------------------
693693
void ControlBar::updateContextCommand( void )
694694
{
695-
Object *obj = NULL;
695+
Object *obj = nullptr;
696696
Int i;
697697

698698
// get object
@@ -703,7 +703,7 @@ void ControlBar::updateContextCommand( void )
703703
// the contents of objects are ususally showed on the UI, when those contents change
704704
// we always to update the UI
705705
//
706-
ContainModuleInterface *contain = obj ? obj->getContain() : NULL;
706+
ContainModuleInterface *contain = obj ? obj->getContain() : nullptr;
707707
if( contain && contain->getContainMax() > 0 &&
708708
m_lastRecordedInventoryCount != contain->getContainCount() )
709709
{
@@ -717,7 +717,7 @@ void ControlBar::updateContextCommand( void )
717717
}
718718

719719
// get production update for those objects that have one
720-
ProductionUpdateInterface *pu = obj ? obj->getProductionUpdateInterface() : NULL;
720+
ProductionUpdateInterface *pu = obj ? obj->getProductionUpdateInterface() : nullptr;
721721

722722
//
723723
// when we have a production update, we show the build queue when there is actually
@@ -728,11 +728,11 @@ void ControlBar::updateContextCommand( void )
728728
if( m_contextParent[ CP_BUILD_QUEUE ]->winIsHidden() == TRUE )
729729
{
730730

731-
if( pu && pu->firstProduction() != NULL )
731+
if( pu && pu->firstProduction() != nullptr )
732732
{
733733

734734
// don't show the portrait image
735-
setPortraitByObject( NULL );
735+
setPortraitByObject( nullptr );
736736

737737
// show the build queue
738738
m_contextParent[ CP_BUILD_QUEUE ]->winHide( FALSE );
@@ -744,7 +744,7 @@ void ControlBar::updateContextCommand( void )
744744
else
745745
{
746746

747-
if( pu && pu->firstProduction() == NULL )
747+
if( pu && pu->firstProduction() == nullptr )
748748
{
749749

750750
// hide the build queue
@@ -762,7 +762,7 @@ void ControlBar::updateContextCommand( void )
762762
{
763763

764764
// when the build queue is enabled, the selected portrait cannot be shown
765-
setPortraitByObject( NULL );
765+
setPortraitByObject( nullptr );
766766

767767
//
768768
// when showing a production queue, when the production count changes of the producer
@@ -821,7 +821,7 @@ void ControlBar::updateContextCommand( void )
821821
// get the command from the control
822822
command = (const CommandButton *)GadgetButtonGetData(win);
823823
//command = (const CommandButton *)win->winGetUserData();
824-
if( command == NULL )
824+
if( command == nullptr )
825825
continue;
826826

827827

@@ -911,18 +911,18 @@ const Image* ControlBar::calculateVeterancyOverlayForThing( const ThingTemplate
911911

912912
if( !thingTemplate )
913913
{
914-
return NULL;
914+
return nullptr;
915915
}
916916

917917
Player *player = ThePlayerList->getLocalPlayer();
918918
if( !player )
919919
{
920-
return NULL;
920+
return nullptr;
921921
}
922922

923923
//See if the thingTemplate has a VeterancyGainCreate
924924
//This is HORROR CODE and needs to be optimized!
925-
const VeterancyGainCreateModuleData *data = NULL;
925+
const VeterancyGainCreateModuleData *data = nullptr;
926926
AsciiString modName;
927927
const ModuleInfo& mi = thingTemplate->getBehaviorModuleInfo();
928928
for( Int modIdx = 0; modIdx < mi.getCount(); ++modIdx )
@@ -958,15 +958,15 @@ const Image* ControlBar::calculateVeterancyOverlayForThing( const ThingTemplate
958958
case LEVEL_HEROIC:
959959
return m_rankHeroicIcon;
960960
}
961-
return NULL;
961+
return nullptr;
962962
}
963963

964964
//-------------------------------------------------------------------------------------------------
965965
const Image* ControlBar::calculateVeterancyOverlayForObject( const Object *obj )
966966
{
967967
if( !obj )
968968
{
969-
return NULL;
969+
return nullptr;
970970
}
971971
VeterancyLevel level = obj->getVeterancyLevel();
972972

@@ -980,14 +980,14 @@ const Image* ControlBar::calculateVeterancyOverlayForObject( const Object *obj )
980980
case LEVEL_HEROIC:
981981
return m_rankHeroicIcon;
982982
}
983-
return NULL;
983+
return nullptr;
984984
}
985985

986986
//-------------------------------------------------------------------------------------------------
987987
static Int getRappellerCount(Object* obj)
988988
{
989989
Int num = 0;
990-
const ContainedItemsList* items = obj->getContain() ? obj->getContain()->getContainedItemsList() : NULL;
990+
const ContainedItemsList* items = obj->getContain() ? obj->getContain()->getContainedItemsList() : nullptr;
991991
if (items)
992992
{
993993
for (ContainedItemsList::const_iterator it = items->begin(); it != items->end(); ++it )
@@ -1017,7 +1017,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
10171017
if (ThePlayerList && ThePlayerList->getLocalPlayer())
10181018
obj = ThePlayerList->getLocalPlayer()->findMostReadyShortcutSpecialPowerOfType( command->getSpecialPowerTemplate()->getSpecialPowerType() );
10191019
else
1020-
obj = NULL;
1020+
obj = nullptr;
10211021
}
10221022

10231023
//If we modify the button (like a gadget clock overlay), then sometimes we may wish to apply it to a specific different button.
@@ -1027,7 +1027,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
10271027
applyToWin = win;
10281028
}
10291029

1030-
if (obj == NULL)
1030+
if (obj == nullptr)
10311031
return COMMAND_HIDDEN; // probably better than crashing....
10321032

10331033
Player *player = obj->getControllingPlayer();
@@ -1141,14 +1141,14 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
11411141
return COMMAND_RESTRICTED;
11421142

11431143
// get the dozer ai update interface
1144-
DozerAIInterface* dozerAI = NULL;
1145-
if( obj->getAIUpdateInterface() == NULL )
1144+
DozerAIInterface* dozerAI = nullptr;
1145+
if( obj->getAIUpdateInterface() == nullptr )
11461146
return COMMAND_RESTRICTED;
11471147

11481148
dozerAI = obj->getAIUpdateInterface()->getDozerAIInterface();
11491149

11501150
DEBUG_ASSERTCRASH( dozerAI != NULL, ("Something KINDOF_DOZER must have a Dozer-like AIUpdate") );
1151-
if( dozerAI == NULL )
1151+
if( dozerAI == nullptr )
11521152
return COMMAND_RESTRICTED;
11531153

11541154
// if building anything at all right now we can't build another
@@ -1249,7 +1249,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
12491249
return COMMAND_RESTRICTED;
12501250
}
12511251
// no production update, can't possibly do this command
1252-
if( pu == NULL )
1252+
if( pu == nullptr )
12531253
{
12541254
DEBUG_CRASH(("Objects that have Object-Level Upgrades must also have ProductionUpdate. Just cuz."));
12551255
return COMMAND_RESTRICTED;
@@ -1283,7 +1283,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
12831283
AIUpdateInterface *ai = obj->getAIUpdateInterface();
12841284

12851285
// no ai, can't possibly fire weapon
1286-
if( ai == NULL )
1286+
if( ai == nullptr )
12871287
return COMMAND_RESTRICTED;
12881288

12891289
// ask the ai if the weapon is ready to fire
@@ -1302,7 +1302,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
13021302
return COMMAND_AVAILABLE;
13031303
}
13041304

1305-
if( w == NULL // No weapon
1305+
if( w == nullptr // No weapon
13061306
|| w->getStatus() != READY_TO_FIRE // Weapon not ready
13071307
|| w->getPossibleNextShotFrame() == now // Weapon ready, but could fire this exact frame (handle button flicker since it may be going to fire anyway)
13081308
/// @todo srj -- not sure why this next check is necessary, but the Comanche missile buttons will flicker without it. figure out someday.
@@ -1313,7 +1313,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
13131313
|| (w->getPossibleNextShotFrame()==now-1)
13141314
)
13151315
{
1316-
if ( w != NULL )
1316+
if ( w != nullptr )
13171317
{
13181318
// only draw the clock when reloading a clip, not when merely between shots, since that's usually a tiny amount of time
13191319
if ( w->getStatus() == RELOADING_CLIP)
@@ -1392,7 +1392,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
13921392
DockUpdateInterface *dui = obj->getDockUpdateInterface();
13931393

13941394
// if the dock is closed or not present this command is invalid
1395-
if( dui == NULL || dui->isDockOpen() == FALSE )
1395+
if( dui == nullptr || dui->isDockOpen() == FALSE )
13961396
return COMMAND_RESTRICTED;
13971397
break;
13981398
}
@@ -1408,7 +1408,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
14081408
// get special power module from the object to execute it
14091409
SpecialPowerModuleInterface *mod = obj->getSpecialPowerModule( command->getSpecialPowerTemplate() );
14101410

1411-
if( mod == NULL )
1411+
if( mod == nullptr )
14121412
{
14131413
// sanity ... we must have a module for the special power, if we don't somebody probably
14141414
// forgot to put it in the object
@@ -1468,7 +1468,7 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
14681468
DEBUG_ASSERTCRASH( w, ("Unit %s's CommandButton %s is trying to access weaponslot %d, but doesn't have a weapon there in its FactionUnit ini entry.",
14691469
obj->getTemplate()->getName().str(), command->getName().str(), (Int)command->getWeaponSlot() ) );
14701470

1471-
if( w == NULL)
1471+
if( w == nullptr)
14721472
return COMMAND_RESTRICTED;
14731473

14741474
const DrawableList *selected = TheInGameUI->getAllSelectedDrawables();

0 commit comments

Comments
 (0)