From 8f7785771b9e02b1a1daf7a252550d78ea93053d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sat, 17 Jun 2017 19:11:28 +0200 Subject: Cpp11 initializers 2 (#5999) * C++11 patchset 10: continue cleanup on constructors * Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop) * More classes cleanup * More classes cleanup + change NULL tests to boolean tests --- src/client.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index 7a097bc0d..aa6a5d30d 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -221,7 +221,7 @@ Client::~Client() scene::IAnimatedMesh *mesh = m_device->getSceneManager()->getMeshCache()->getMeshByIndex(0); - if (mesh != NULL) + if (mesh) m_device->getSceneManager()->getMeshCache()->removeMesh(mesh); } @@ -383,7 +383,7 @@ void Client::step(float dtime) */ // Control local player (0ms) LocalPlayer *player = m_env.getLocalPlayer(); - assert(player != NULL); + assert(player); player->applyControl(dtime); // Step environment @@ -459,7 +459,7 @@ void Client::step(float dtime) if (block) { // Delete the old mesh delete block->mesh; - block->mesh = NULL; + block->mesh = nullptr; if (r.mesh) { minimap_mapblock = r.mesh->moveMinimapMapblock(); @@ -1370,7 +1370,7 @@ void Client::addNode(v3s16 p, MapNode n, bool remove_metadata) void Client::setPlayerControl(PlayerControl &control) { LocalPlayer *player = m_env.getLocalPlayer(); - assert(player != NULL); + assert(player); player->control = control; } @@ -1394,7 +1394,7 @@ bool Client::getLocalInventoryUpdated() void Client::getLocalInventory(Inventory &dst) { LocalPlayer *player = m_env.getLocalPlayer(); - assert(player != NULL); + assert(player); dst = player->inventory; } @@ -1407,7 +1407,7 @@ Inventory* Client::getInventory(const InventoryLocation &loc) case InventoryLocation::CURRENT_PLAYER: { LocalPlayer *player = m_env.getLocalPlayer(); - assert(player != NULL); + assert(player); return &player->inventory; } break; @@ -1496,7 +1496,7 @@ void Client::setCrack(int level, v3s16 pos) u16 Client::getHP() { LocalPlayer *player = m_env.getLocalPlayer(); - assert(player != NULL); + assert(player); return player->hp; } @@ -1529,7 +1529,7 @@ void Client::typeChatMessage(const std::wstring &message) // compatibility code if (m_proto_ver < 29) { LocalPlayer *player = m_env.getLocalPlayer(); - assert(player != NULL); + assert(player); std::wstring name = narrow_to_wide(player->getName()); pushToChatQueue((std::wstring)L"<" + name + L"> " + message); } -- cgit v1.2.3