diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-06-06 23:34:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-06-07 19:23:40 +0300 |
commit | 36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch) | |
tree | 190156cb88b13a38a6d13c69ee0742cc078065a1 /src/net/ea/inventoryrecv.cpp | |
parent | f1518dd8476c968a43fa57cfb06198e290a4f77a (diff) | |
download | plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2 plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz plus-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip |
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/net/ea/inventoryrecv.cpp')
-rw-r--r-- | src/net/ea/inventoryrecv.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/net/ea/inventoryrecv.cpp b/src/net/ea/inventoryrecv.cpp index 6ef9f0086..0ccde29d4 100644 --- a/src/net/ea/inventoryrecv.cpp +++ b/src/net/ea/inventoryrecv.cpp @@ -58,7 +58,7 @@ namespace InventoryRecv void InventoryRecv::processPlayerInventoryUse(Net::MessageIn &msg) { BLOCK_START("InventoryRecv::processPlayerInventoryUse") - Inventory *const inventory = localPlayer + Inventory *const inventory = localPlayer != nullptr ? PlayerInfo::getInventory() : nullptr; const int index = msg.readInt16("index") - INVENTORY_OFFSET; @@ -67,11 +67,11 @@ void InventoryRecv::processPlayerInventoryUse(Net::MessageIn &msg) const int amount = msg.readInt16("amount"); msg.readUInt8("type"); - if (inventory) + if (inventory != nullptr) { if (Item *const item = inventory->getItem(index)) { - if (amount) + if (amount != 0) item->setQuantity(amount); else inventory->removeItemAt(index); @@ -83,7 +83,7 @@ void InventoryRecv::processPlayerInventoryUse(Net::MessageIn &msg) void InventoryRecv::processItemUseResponse(Net::MessageIn &msg) { BLOCK_START("InventoryRecv::processItemUseResponse") - Inventory *const inventory = localPlayer + Inventory *const inventory = localPlayer != nullptr ? PlayerInfo::getInventory() : nullptr; const int index = msg.readInt16("index") - INVENTORY_OFFSET; @@ -95,11 +95,11 @@ void InventoryRecv::processItemUseResponse(Net::MessageIn &msg) } else { - if (inventory) + if (inventory != nullptr) { if (Item *const item = inventory->getItem(index)) { - if (amount) + if (amount != 0) item->setQuantity(amount); else inventory->removeItemAt(index); @@ -120,7 +120,7 @@ void InventoryRecv::processPlayerStorageStatus(Net::MessageIn &msg) msg.readInt16("used count"); const int size = msg.readInt16("max size"); - if (!mStorage) + if (mStorage == nullptr) mStorage = new Inventory(InventoryType::Storage, size); FOR_EACH (Ea::InventoryItems::const_iterator, it, mInventoryItems) @@ -139,7 +139,7 @@ void InventoryRecv::processPlayerStorageStatus(Net::MessageIn &msg) } mInventoryItems.clear(); - if (!storageWindow) + if (storageWindow == nullptr) { CREATEWIDGETV(storageWindow, InventoryWindow, mStorage); } @@ -151,14 +151,14 @@ void InventoryRecv::processPlayerStorageClose(Net::MessageIn &msg A_UNUSED) BLOCK_START("InventoryRecv::processPlayerStorageClose") // Storage access has been closed // Storage window deletes itself - if (storageWindow) + if (storageWindow != nullptr) { storageWindow->unsetInventory(); storageWindow->close(); } storageWindow = nullptr; - if (mStorage) + if (mStorage != nullptr) mStorage->clear(); delete2(mStorage); @@ -169,7 +169,7 @@ void InventoryRecv::processPlayerAttackRange(Net::MessageIn &msg) { BLOCK_START("InventoryRecv::processPlayerAttackRange") const int range = msg.readInt16("range"); - if (localPlayer) + if (localPlayer != nullptr) localPlayer->setAttackRange(range); PlayerInfo::setStatBase(Attributes::PLAYER_ATTACK_RANGE, range); PlayerInfo::setStatMod(Attributes::PLAYER_ATTACK_RANGE, 0); |