- replaced some NULLs with nullptr.

This commit is contained in:
Christoph Oelckers 2019-01-06 09:39:35 +01:00
parent 8ead5a3a6b
commit a11eea98b5
8 changed files with 53 additions and 53 deletions

View file

@ -71,14 +71,14 @@ DBot::DBot ()
void DBot::Clear () void DBot::Clear ()
{ {
player = NULL; player = nullptr;
Angle = 0.; Angle = 0.;
dest = NULL; dest = nullptr;
prev = NULL; prev = nullptr;
enemy = NULL; enemy = nullptr;
missile = NULL; missile = nullptr;
mate = NULL; mate = nullptr;
last_mate = NULL; last_mate = nullptr;
memset(&skill, 0, sizeof(skill)); memset(&skill, 0, sizeof(skill));
t_active = 0; t_active = 0;
t_respawn = 0; t_respawn = 0;
@ -138,7 +138,7 @@ void DBot::Tick ()
{ {
Super::Tick (); Super::Tick ();
if (player->mo == NULL || bglobal.freeze) if (player->mo == nullptr || bglobal.freeze)
{ {
return; return;
} }
@ -176,7 +176,7 @@ CCMD (addbot)
if (argv.argc() > 1) if (argv.argc() > 1)
bglobal.SpawnBot (argv[1]); bglobal.SpawnBot (argv[1]);
else else
bglobal.SpawnBot (NULL); bglobal.SpawnBot (nullptr);
} }
void FCajunMaster::ClearPlayer (int i, bool keepTeam) void FCajunMaster::ClearPlayer (int i, bool keepTeam)
@ -184,7 +184,7 @@ void FCajunMaster::ClearPlayer (int i, bool keepTeam)
if (players[i].mo) if (players[i].mo)
{ {
players[i].mo->Destroy (); players[i].mo->Destroy ();
players[i].mo = NULL; players[i].mo = nullptr;
} }
botinfo_t *bot = botinfo; botinfo_t *bot = botinfo;
while (bot && stricmp (players[i].userinfo.GetName(), bot->name)) while (bot && stricmp (players[i].userinfo.GetName(), bot->name))
@ -194,10 +194,10 @@ void FCajunMaster::ClearPlayer (int i, bool keepTeam)
bot->inuse = BOTINUSE_No; bot->inuse = BOTINUSE_No;
bot->lastteam = keepTeam ? players[i].userinfo.GetTeam() : TEAM_NONE; bot->lastteam = keepTeam ? players[i].userinfo.GetTeam() : TEAM_NONE;
} }
if (players[i].Bot != NULL) if (players[i].Bot != nullptr)
{ {
players[i].Bot->Destroy (); players[i].Bot->Destroy ();
players[i].Bot = NULL; players[i].Bot = nullptr;
} }
players[i].~player_t(); players[i].~player_t();
::new(&players[i]) player_t; ::new(&players[i]) player_t;
@ -261,7 +261,7 @@ void InitBotStuff()
while (sc.GetString()) while (sc.GetString())
{ {
PClassActor *wcls = PClass::FindActor(sc.String); PClassActor *wcls = PClass::FindActor(sc.String);
if (wcls != NULL && wcls->IsDescendantOf(NAME_Weapon)) if (wcls != nullptr && wcls->IsDescendantOf(NAME_Weapon))
{ {
BotInfoData bi = {}; BotInfoData bi = {};
sc.MustGetStringName(","); sc.MustGetStringName(",");
@ -306,7 +306,7 @@ void InitBotStuff()
for(unsigned i=0;i<countof(warnbotmissiles);i++) for(unsigned i=0;i<countof(warnbotmissiles);i++)
{ {
AActor *a = GetDefaultByName (warnbotmissiles[i]); AActor *a = GetDefaultByName (warnbotmissiles[i]);
if (a != NULL) if (a != nullptr)
{ {
a->flags3|=MF3_WARNBOT; a->flags3|=MF3_WARNBOT;
} }

View file

@ -63,7 +63,7 @@ void DBot::Think ()
memset (cmd, 0, sizeof(*cmd)); memset (cmd, 0, sizeof(*cmd));
if (enemy && enemy->health <= 0) if (enemy && enemy->health <= 0)
enemy = NULL; enemy = nullptr;
if (player->mo->health > 0) //Still alive if (player->mo->health > 0) //Still alive
{ {

View file

@ -39,7 +39,7 @@ IMPLEMENT_CLASS(DSectorEffect, false, false)
DSectorEffect::DSectorEffect () DSectorEffect::DSectorEffect ()
: DThinker(STAT_SECTOREFFECT) : DThinker(STAT_SECTOREFFECT)
{ {
m_Sector = NULL; m_Sector = nullptr;
} }
void DSectorEffect::OnDestroy() void DSectorEffect::OnDestroy()
@ -48,15 +48,15 @@ void DSectorEffect::OnDestroy()
{ {
if (m_Sector->floordata == this) if (m_Sector->floordata == this)
{ {
m_Sector->floordata = NULL; m_Sector->floordata = nullptr;
} }
if (m_Sector->ceilingdata == this) if (m_Sector->ceilingdata == this)
{ {
m_Sector->ceilingdata = NULL; m_Sector->ceilingdata = nullptr;
} }
if (m_Sector->lightingdata == this) if (m_Sector->lightingdata == this)
{ {
m_Sector->lightingdata = NULL; m_Sector->lightingdata = nullptr;
} }
} }
Super::OnDestroy(); Super::OnDestroy();
@ -91,7 +91,7 @@ IMPLEMENT_POINTERS_END
DMover::DMover (sector_t *sector) DMover::DMover (sector_t *sector)
: DSectorEffect (sector) : DSectorEffect (sector)
{ {
interpolation = NULL; interpolation = nullptr;
} }
void DMover::OnDestroy() void DMover::OnDestroy()
@ -108,10 +108,10 @@ void DMover::Serialize(FSerializer &arc)
void DMover::StopInterpolation(bool force) void DMover::StopInterpolation(bool force)
{ {
if (interpolation != NULL) if (interpolation != nullptr)
{ {
interpolation->DelRef(force); interpolation->DelRef(force);
interpolation = NULL; interpolation = nullptr;
} }
} }

View file

@ -109,7 +109,7 @@ void DFsScript::ClearChildren()
for(j=0;j<MAXSCRIPTS;j++) if (children[j]) for(j=0;j<MAXSCRIPTS;j++) if (children[j])
{ {
children[j]->Destroy(); children[j]->Destroy();
children[j]=NULL; children[j]=nullptr;
} }
} }
@ -123,15 +123,15 @@ DFsScript::DFsScript()
{ {
int i; int i;
for(i=0; i<SECTIONSLOTS; i++) sections[i] = NULL; for(i=0; i<SECTIONSLOTS; i++) sections[i] = nullptr;
for(i=0; i<VARIABLESLOTS; i++) variables[i] = NULL; for(i=0; i<VARIABLESLOTS; i++) variables[i] = nullptr;
for(i=0; i<MAXSCRIPTS; i++) children[i] = NULL; for(i=0; i<MAXSCRIPTS; i++) children[i] = nullptr;
data = NULL; data = nullptr;
scriptnum = -1; scriptnum = -1;
len = 0; len = 0;
parent = NULL; parent = nullptr;
trigger = NULL; trigger = nullptr;
lastiftrue = false; lastiftrue = false;
} }
@ -144,8 +144,8 @@ DFsScript::DFsScript()
DFsScript::~DFsScript() DFsScript::~DFsScript()
{ {
if (data != NULL) delete[] data; if (data != nullptr) delete[] data;
data = NULL; data = nullptr;
} }
//========================================================================== //==========================================================================
@ -159,11 +159,11 @@ void DFsScript::OnDestroy()
ClearVariables(true); ClearVariables(true);
ClearSections(); ClearSections();
ClearChildren(); ClearChildren();
parent = NULL; parent = nullptr;
if (data != NULL) delete [] data; if (data != nullptr) delete [] data;
data = NULL; data = nullptr;
parent = NULL; parent = nullptr;
trigger = NULL; trigger = nullptr;
Super::OnDestroy(); Super::OnDestroy();
} }
@ -202,7 +202,7 @@ void DFsScript::Serialize(FSerializer &arc)
void DFsScript::ParseScript(char *position) void DFsScript::ParseScript(char *position)
{ {
if (position == NULL) if (position == nullptr)
{ {
lastiftrue = false; lastiftrue = false;
position = data; position = data;
@ -257,7 +257,7 @@ IMPLEMENT_POINTERS_END
DRunningScript::DRunningScript(AActor *trigger, DFsScript *owner, int index) DRunningScript::DRunningScript(AActor *trigger, DFsScript *owner, int index)
{ {
prev = next = NULL; prev = next = nullptr;
script = owner; script = owner;
GC::WriteBarrier(this, script); GC::WriteBarrier(this, script);
save_point = index; save_point = index;
@ -265,9 +265,9 @@ DRunningScript::DRunningScript(AActor *trigger, DFsScript *owner, int index)
wait_data = 0; wait_data = 0;
this->trigger = trigger; this->trigger = trigger;
if (owner == NULL) if (owner == nullptr)
{ {
for(int i=0; i< VARIABLESLOTS; i++) variables[i] = NULL; for(int i=0; i< VARIABLESLOTS; i++) variables[i] = nullptr;
} }
else else
{ {
@ -320,7 +320,7 @@ void DRunningScript::OnDestroy()
current->Destroy(); current->Destroy();
current = next; // go to next in chain current = next; // go to next in chain
} }
variables[i] = NULL; variables[i] = nullptr;
} }
Super::OnDestroy(); Super::OnDestroy();
} }
@ -395,16 +395,16 @@ void DFraggleThinker::OnDestroy()
{ {
DRunningScript *q = p; DRunningScript *q = p;
p = p->next; p = p->next;
q->prev = q->next = NULL; q->prev = q->next = nullptr;
q->Destroy(); q->Destroy();
} }
RunningScripts = NULL; RunningScripts = nullptr;
GlobalScript->Destroy(); GlobalScript->Destroy();
GlobalScript = NULL; GlobalScript = nullptr;
LevelScript->Destroy(); LevelScript->Destroy();
LevelScript = NULL; LevelScript = nullptr;
SpawnedThings.Clear(); SpawnedThings.Clear();
Super::OnDestroy(); Super::OnDestroy();
@ -508,7 +508,7 @@ void DFraggleThinker::Tick()
{ {
current->script->variables[i] = current->variables[i]; current->script->variables[i] = current->variables[i];
GC::WriteBarrier(current->script, current->variables[i]); GC::WriteBarrier(current->script, current->variables[i]);
current->variables[i] = NULL; current->variables[i] = nullptr;
} }
current->script->trigger = current->trigger; // copy trigger current->script->trigger = current->trigger; // copy trigger

View file

@ -232,7 +232,7 @@ public:
DFsSection() DFsSection()
{ {
next = NULL; next = nullptr;
} }
void Serialize(FSerializer &ar); void Serialize(FSerializer &ar);

View file

@ -104,7 +104,7 @@ void P_TouchSpecialThing (AActor *special, AActor *toucher)
if (toucher->player != NULL && toucher->player->Bot != NULL && special == toucher->player->Bot->dest) if (toucher->player != NULL && toucher->player->Bot != NULL && special == toucher->player->Bot->dest)
{ {
toucher->player->Bot->prev = toucher->player->Bot->dest; toucher->player->Bot->prev = toucher->player->Bot->dest;
toucher->player->Bot->dest = NULL; toucher->player->Bot->dest = nullptr;
} }
special->CallTouch (toucher); special->CallTouch (toucher);
} }

View file

@ -54,15 +54,15 @@ DPillar::DPillar ()
void DPillar::OnDestroy() void DPillar::OnDestroy()
{ {
if (m_Interp_Ceiling != NULL) if (m_Interp_Ceiling != nullptr)
{ {
m_Interp_Ceiling->DelRef(); m_Interp_Ceiling->DelRef();
m_Interp_Ceiling = NULL; m_Interp_Ceiling = nullptr;
} }
if (m_Interp_Floor != NULL) if (m_Interp_Floor != nullptr)
{ {
m_Interp_Floor->DelRef(); m_Interp_Floor->DelRef();
m_Interp_Floor = NULL; m_Interp_Floor = nullptr;
} }
Super::OnDestroy(); Super::OnDestroy();
} }

View file

@ -52,7 +52,7 @@ struct FInterpolator
public: public:
FInterpolator() FInterpolator()
{ {
Head = NULL; Head = nullptr;
didInterp = false; didInterp = false;
count = 0; count = 0;
} }