diff options
Diffstat (limited to 'src/gui/shortcut')
-rw-r--r-- | src/gui/shortcut/dropshortcut.cpp | 12 | ||||
-rw-r--r-- | src/gui/shortcut/emoteshortcut.cpp | 8 | ||||
-rw-r--r-- | src/gui/shortcut/emoteshortcut.h | 2 | ||||
-rw-r--r-- | src/gui/shortcut/itemshortcut.cpp | 28 | ||||
-rw-r--r-- | src/gui/shortcut/shortcutbase.cpp | 4 | ||||
-rw-r--r-- | src/gui/shortcut/spellshortcut.cpp | 2 |
6 files changed, 28 insertions, 28 deletions
diff --git a/src/gui/shortcut/dropshortcut.cpp b/src/gui/shortcut/dropshortcut.cpp index 1afea70ec..f9876ebee 100644 --- a/src/gui/shortcut/dropshortcut.cpp +++ b/src/gui/shortcut/dropshortcut.cpp @@ -53,7 +53,7 @@ DropShortcut::~DropShortcut() void DropShortcut::dropFirst() const { - if (!localPlayer) + if (localPlayer == nullptr) return; if (!PacketLimiter::limitPackets(PacketType::PACKET_DROP)) @@ -68,7 +68,7 @@ void DropShortcut::dropFirst() const { const Item *const item = PlayerInfo::getInventory() ->findItem(itemId, itemColor); - if (item && item->getQuantity()) + if ((item != nullptr) && (item->getQuantity() != 0)) { const int cnt = settings.quickDropCounter; if (localPlayer->isServerBuggy()) @@ -86,7 +86,7 @@ void DropShortcut::dropFirst() const void DropShortcut::dropItems(const int cnt) { - if (!localPlayer) + if (localPlayer == nullptr) return; if (localPlayer->isServerBuggy()) @@ -114,7 +114,7 @@ void DropShortcut::dropItems(const int cnt) bool DropShortcut::dropItem(const int cnt) { const Inventory *const inv = PlayerInfo::getInventory(); - if (!inv) + if (inv == nullptr) return false; int itemId = 0; @@ -133,7 +133,7 @@ bool DropShortcut::dropItem(const int cnt) if (itemId > 0) { const Item *const item = inv->findItem(itemId, itemColor); - if (item && + if ((item != nullptr) && item->getQuantity() > 0) { PlayerInfo::dropItem(item, cnt, Sfx_true); @@ -158,7 +158,7 @@ bool DropShortcut::dropItem(const int cnt) if (itemId > 0) { const Item *const item = inv->findItem(itemId, itemColor); - if (item && item->getQuantity() > 0) + if ((item != nullptr) && item->getQuantity() > 0) { PlayerInfo::dropItem(item, cnt, Sfx_true); return true; diff --git a/src/gui/shortcut/emoteshortcut.cpp b/src/gui/shortcut/emoteshortcut.cpp index ac9581fa3..0fcf4abaf 100644 --- a/src/gui/shortcut/emoteshortcut.cpp +++ b/src/gui/shortcut/emoteshortcut.cpp @@ -56,7 +56,7 @@ void EmoteShortcut::load() i++) { const EmoteSprite *const sprite = EmoteDB::getSprite(i, true); - if (sprite) + if (sprite != nullptr) { mEmotes[j] = CAST_U8(i + 1); j ++; @@ -68,7 +68,7 @@ void EmoteShortcut::save() const { for (int i = 0; i < SHORTCUT_EMOTES; i++) { - const unsigned char emoteId = mEmotes[i] ? mEmotes[i] + const unsigned char emoteId = mEmotes[i] != 0u ? mEmotes[i] : CAST_U8(0); serverConfig.setValue("emoteshortcut" + toString(i), CAST_U32(emoteId)); @@ -77,7 +77,7 @@ void EmoteShortcut::save() const void EmoteShortcut::useEmotePlayer(const int index) const { - if (!localPlayer) + if (localPlayer == nullptr) return; if (index > 0 && @@ -90,7 +90,7 @@ void EmoteShortcut::useEmotePlayer(const int index) const void EmoteShortcut::useEmote(const int index) const { - if (!localPlayer) + if (localPlayer == nullptr) return; if (index > 0 && diff --git a/src/gui/shortcut/emoteshortcut.h b/src/gui/shortcut/emoteshortcut.h index b9bbb920e..14d68fbc6 100644 --- a/src/gui/shortcut/emoteshortcut.h +++ b/src/gui/shortcut/emoteshortcut.h @@ -98,7 +98,7 @@ class EmoteShortcut final * A flag to check if the Emote is selected. */ bool isEmoteSelected() const noexcept2 A_WARN_UNUSED - { return mEmoteSelected; } + { return mEmoteSelected != 0u; } /** * Remove a Emote from the shortcut. diff --git a/src/gui/shortcut/itemshortcut.cpp b/src/gui/shortcut/itemshortcut.cpp index 9f1c0705c..5828ae4e7 100644 --- a/src/gui/shortcut/itemshortcut.cpp +++ b/src/gui/shortcut/itemshortcut.cpp @@ -64,7 +64,7 @@ void ItemShortcut::load() std::string data; const Configuration *cfg = &serverConfig; - if (mNumber) + if (mNumber != 0) { name = std::string("shortcut").append(toString(mNumber)).append("_"); color = std::string("shortcutColor").append( @@ -96,7 +96,7 @@ void ItemShortcut::save() const std::string name; std::string color; std::string data; - if (mNumber) + if (mNumber != 0) { name = std::string("shortcut").append(toString(mNumber)).append("_"); color = std::string("shortcutColor").append( @@ -113,7 +113,7 @@ void ItemShortcut::save() const for (unsigned int i = 0; i < SHORTCUT_ITEMS; i++) { - const int itemId = mItems[i] ? mItems[i] : -1; + const int itemId = mItems[i] != 0 ? mItems[i] : -1; const int itemColor = toInt(mItemColors[i], int); const std::string itemData = mItemData[i]; if (itemId != -1) @@ -134,7 +134,7 @@ void ItemShortcut::save() const void ItemShortcut::useItem(const int index) const { const Inventory *const inv = PlayerInfo::getInventory(); - if (!inv) + if (inv == nullptr) return; const int itemId = mItems[index]; @@ -144,14 +144,14 @@ void ItemShortcut::useItem(const int index) const if (itemId < SPELL_MIN_ID) { const Item *const item = inv->findItem(itemId, itemColor); - if (item && item->getQuantity()) + if ((item != nullptr) && (item->getQuantity() != 0)) PlayerInfo::useEquipItem(item, Sfx_true); } - else if (itemId < SKILL_MIN_ID && spellManager) + else if (itemId < SKILL_MIN_ID && (spellManager != nullptr)) { spellManager->useItem(itemId); } - else if (skillDialog) + else if (skillDialog != nullptr) { skillDialog->useItem(itemId, fromBool(config.getBoolValue("skillAutotarget"), AutoTarget), @@ -164,14 +164,14 @@ void ItemShortcut::useItem(const int index) const void ItemShortcut::equipItem(const int index) const { const Inventory *const inv = PlayerInfo::getInventory(); - if (!inv) + if (inv == nullptr) return; const int itemId = mItems[index]; - if (itemId) + if (itemId != 0) { const Item *const item = inv->findItem(itemId, mItemColors[index]); - if (item && item->getQuantity()) + if ((item != nullptr) && (item->getQuantity() != 0)) { if (item->isEquipment() == Equipm_true) { @@ -184,14 +184,14 @@ void ItemShortcut::equipItem(const int index) const void ItemShortcut::unequipItem(const int index) const { const Inventory *const inv = PlayerInfo::getInventory(); - if (!inv) + if (inv == nullptr) return; const int itemId = mItems[index]; - if (itemId) + if (itemId != 0) { const Item *const item = inv->findItem(itemId, mItemColors[index]); - if (item && item->getQuantity()) + if ((item != nullptr) && (item->getQuantity() != 0)) { if (item->isEquipment() == Equipm_true) { @@ -204,7 +204,7 @@ void ItemShortcut::unequipItem(const int index) const void ItemShortcut::setItemSelected(const Item *const item) { - if (item) + if (item != nullptr) { mItemSelected = item->getId(); mItemColorSelected = item->getColor(); diff --git a/src/gui/shortcut/shortcutbase.cpp b/src/gui/shortcut/shortcutbase.cpp index 0b3121ee0..8b7bf80c3 100644 --- a/src/gui/shortcut/shortcutbase.cpp +++ b/src/gui/shortcut/shortcutbase.cpp @@ -74,7 +74,7 @@ void ShortcutBase::save() const { for (int i = 0; i < mMaxSize; i++) { - const int itemId = mItems[i] ? mItems[i] : -1; + const int itemId = mItems[i] != 0 ? mItems[i] : -1; const int itemColor = (mItemColors[i] != ItemColor_zero) ? toInt(mItemColors[i], int) : 1; if (itemId != -1) @@ -92,7 +92,7 @@ void ShortcutBase::save() const void ShortcutBase::setItemSelected(const Item *const item) { - if (item) + if (item != nullptr) { mItemSelected = item->getId(); mItemColorSelected = item->getColor(); diff --git a/src/gui/shortcut/spellshortcut.cpp b/src/gui/shortcut/spellshortcut.cpp index 9cec4cd9a..ef6815a2c 100644 --- a/src/gui/shortcut/spellshortcut.cpp +++ b/src/gui/shortcut/spellshortcut.cpp @@ -44,7 +44,7 @@ void SpellShortcut::load() for (unsigned f = 0; f < SPELLS_SIZE; f ++) mItems[f] = -1; - if (!spellManager) + if (spellManager == nullptr) return; const std::vector<TextCommand*> &spells = spellManager->getAll(); |