[General] Change NULL to nullptr

pull/249/merge
Koncord 8 years ago
parent 2b1b4ce2f1
commit 5b2cab4c6b

@ -183,7 +183,7 @@ void CellController::removeLocalActorRecord(std::string actorIndex)
bool CellController::isLocalActor(MWWorld::Ptr ptr) bool CellController::isLocalActor(MWWorld::Ptr ptr)
{ {
if (ptr.mRef == NULL) if (ptr.mRef == nullptr)
return false; return false;
std::string mapIndex = generateMapIndex(ptr); std::string mapIndex = generateMapIndex(ptr);
@ -231,7 +231,7 @@ bool CellController::isDedicatedActor(int refNumIndex, int mpNum)
bool CellController::isDedicatedActor(MWWorld::Ptr ptr) bool CellController::isDedicatedActor(MWWorld::Ptr ptr)
{ {
if (ptr.mRef == NULL) if (ptr.mRef == nullptr)
return false; return false;
std::string mapIndex = generateMapIndex(ptr); std::string mapIndex = generateMapIndex(ptr);
@ -313,7 +313,7 @@ MWWorld::CellStore *CellController::getCellStore(const ESM::Cell& cell)
} }
catch (std::exception&) catch (std::exception&)
{ {
cellStore = NULL; cellStore = nullptr;
} }
} }

@ -92,7 +92,7 @@ void mwmp::GUIController::showDialogList(const mwmp::BasePlayer::GUIMessageBox &
{ {
MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager(); MWBase::WindowManager *windowManager = MWBase::Environment::get().getWindowManager();
windowManager->removeDialog(mListBox); windowManager->removeDialog(mListBox);
mListBox = NULL; mListBox = nullptr;
std::vector<std::string> list; std::vector<std::string> list;
@ -360,7 +360,7 @@ void mwmp::GUIController::setGlobalMapMarkerTooltip(MWGui::MapWindow *mapWindow,
if (!destNotes.empty()) if (!destNotes.empty())
{ {
MWGui::LocalMapBase::MarkerUserData data (NULL); MWGui::LocalMapBase::MarkerUserData data (nullptr);
data.notes = destNotes; data.notes = destNotes;
data.caption = markerWidget->getUserString("Caption_TextOneLine"); data.caption = markerWidget->getUserString("Caption_TextOneLine");

@ -71,7 +71,7 @@ Attack *MechanicsHelper::getLocalAttack(const MWWorld::Ptr& ptr)
else if (mwmp::Main::get().getCellController()->isLocalActor(ptr)) else if (mwmp::Main::get().getCellController()->isLocalActor(ptr))
return &mwmp::Main::get().getCellController()->getLocalActor(ptr)->attack; return &mwmp::Main::get().getCellController()->getLocalActor(ptr)->attack;
return NULL; return nullptr;
} }
Attack *MechanicsHelper::getDedicatedAttack(const MWWorld::Ptr& ptr) Attack *MechanicsHelper::getDedicatedAttack(const MWWorld::Ptr& ptr)
@ -81,7 +81,7 @@ Attack *MechanicsHelper::getDedicatedAttack(const MWWorld::Ptr& ptr)
else if (mwmp::Main::get().getCellController()->isDedicatedActor(ptr)) else if (mwmp::Main::get().getCellController()->isDedicatedActor(ptr))
return &mwmp::Main::get().getCellController()->getDedicatedActor(ptr)->attack; return &mwmp::Main::get().getCellController()->getDedicatedActor(ptr)->attack;
return NULL; return nullptr;
} }
MWWorld::Ptr MechanicsHelper::getPlayerPtr(const Target& target) MWWorld::Ptr MechanicsHelper::getPlayerPtr(const Target& target)
@ -90,11 +90,11 @@ MWWorld::Ptr MechanicsHelper::getPlayerPtr(const Target& target)
{ {
if (target.guid == mwmp::Main::get().getLocalPlayer()->guid) if (target.guid == mwmp::Main::get().getLocalPlayer()->guid)
return MWBase::Environment::get().getWorld()->getPlayerPtr(); return MWBase::Environment::get().getWorld()->getPlayerPtr();
else if (PlayerList::getPlayer(target.guid) != NULL) else if (PlayerList::getPlayer(target.guid) != nullptr)
return PlayerList::getPlayer(target.guid)->getPtr(); return PlayerList::getPlayer(target.guid)->getPtr();
} }
return NULL; return nullptr;
} }
void MechanicsHelper::assignAttackTarget(Attack* attack, const MWWorld::Ptr& target) void MechanicsHelper::assignAttackTarget(Attack* attack, const MWWorld::Ptr& target)
@ -154,7 +154,7 @@ void MechanicsHelper::processAttack(Attack attack, const MWWorld::Ptr& attacker)
{ {
if (attack.target.guid == mwmp::Main::get().getLocalPlayer()->guid) if (attack.target.guid == mwmp::Main::get().getLocalPlayer()->guid)
victim = MWBase::Environment::get().getWorld()->getPlayerPtr(); victim = MWBase::Environment::get().getWorld()->getPlayerPtr();
else if (PlayerList::getPlayer(attack.target.guid) != NULL) else if (PlayerList::getPlayer(attack.target.guid) != nullptr)
victim = PlayerList::getPlayer(attack.target.guid)->getPtr(); victim = PlayerList::getPlayer(attack.target.guid)->getPtr();
} }
else else
@ -182,7 +182,7 @@ void MechanicsHelper::processAttack(Attack attack, const MWWorld::Ptr& attacker)
weapon = MWWorld::Ptr(); weapon = MWWorld::Ptr();
} }
if (victim.mRef != NULL) if (victim.mRef != nullptr)
{ {
bool healthdmg = true; bool healthdmg = true;

@ -91,7 +91,7 @@ void PlayerList::createPlayer(RakNet::RakNetGUID guid)
dedicPlayer->state = 0; dedicPlayer->state = 0;
world->deleteObject(dedicPlayer->ptr); world->deleteObject(dedicPlayer->ptr);
delete dedicPlayer->reference; delete dedicPlayer->reference;
dedicPlayer->reference = NULL; dedicPlayer->reference = nullptr;
reset = true; reset = true;
} }
} }
@ -255,7 +255,7 @@ DedicatedPlayer *PlayerList::getPlayer(const MWWorld::Ptr &ptr)
bool PlayerList::isDedicatedPlayer(const MWWorld::Ptr &ptr) bool PlayerList::isDedicatedPlayer(const MWWorld::Ptr &ptr)
{ {
if (ptr.mRef == NULL) if (ptr.mRef == nullptr)
return false; return false;
return (getPlayer(ptr) != 0); return (getPlayer(ptr) != 0);

@ -14,7 +14,7 @@
using namespace std; using namespace std;
Log *Log::sLog = NULL; Log *Log::sLog = nullptr;
Log::Log(int logLevel) : logLevel(logLevel) Log::Log(int logLevel) : logLevel(logLevel)
{ {
@ -23,17 +23,17 @@ Log::Log(int logLevel) : logLevel(logLevel)
void Log::Create(int logLevel) void Log::Create(int logLevel)
{ {
if (sLog != NULL) if (sLog != nullptr)
return; return;
sLog = new Log(logLevel); sLog = new Log(logLevel);
} }
void Log::Delete() void Log::Delete()
{ {
if (sLog == NULL) if (sLog == nullptr)
return; return;
delete sLog; delete sLog;
sLog = NULL; sLog = nullptr;
} }
const Log &Log::Get() const Log &Log::Get()
@ -98,7 +98,7 @@ void Log::print(int level, bool hasPrefix, const char *file, int line, const cha
sstr << '\n'; sstr << '\n';
va_list args; va_list args;
va_start(args, message); va_start(args, message);
vector<char> buf((unsigned long) (vsnprintf(NULL, 0, sstr.str().c_str(), args) + 1)); vector<char> buf((unsigned long) (vsnprintf(nullptr, 0, sstr.str().c_str(), args) + 1));
va_end(args); va_end(args);
va_start(args, message); va_start(args, message);
vsnprintf(buf.data(), buf.size(), sstr.str().c_str(), args); vsnprintf(buf.data(), buf.size(), sstr.str().c_str(), args);

Loading…
Cancel
Save