summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/actions.cpp286
-rw-r--r--src/actions/chat.cpp126
-rw-r--r--src/actions/commands.cpp245
-rw-r--r--src/actions/move.cpp46
-rw-r--r--src/actions/pets.cpp20
-rw-r--r--src/actions/statusbar.cpp22
-rw-r--r--src/actions/tabs.cpp12
-rw-r--r--src/actions/target.cpp6
-rw-r--r--src/actions/windows.cpp33
9 files changed, 412 insertions, 384 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index c98b2a429..176495a18 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -140,7 +140,7 @@ static int uploadUpdate(void *ptr,
return 0;
UploadChatInfo *const info = reinterpret_cast<UploadChatInfo*>(ptr);
- if (!info)
+ if (info == nullptr)
return 0;
if (status == DownloadStatus::Complete)
@@ -153,7 +153,8 @@ static int uploadUpdate(void *ptr,
str = str.substr(0, sz - 1);
str.append(info->addStr);
ChatTab *const tab = info->tab;
- if (chatWindow && (!tab || chatWindow->isTabPresent(tab)))
+ if (chatWindow != nullptr &&
+ (tab == nullptr || chatWindow->isTabPresent(tab)))
{
str = strprintf("%s [@@%s |%s@@]",
info->text.c_str(), str.c_str(), str.c_str());
@@ -200,7 +201,7 @@ static void uploadFile(const std::string &str,
static Being *findBeing(const std::string &name, const bool npc)
{
- if (!localPlayer || !actorManager)
+ if ((localPlayer == nullptr) || (actorManager == nullptr))
return nullptr;
Being *being = nullptr;
@@ -214,11 +215,11 @@ static Being *findBeing(const std::string &name, const bool npc)
being = actorManager->findBeingByName(
name, ActorType::Unknown);
}
- if (!being && npc)
+ if ((being == nullptr) && npc)
{
being = actorManager->findNearestLivingBeing(
localPlayer, 1, ActorType::Npc, AllowSort_true);
- if (being)
+ if (being != nullptr)
{
if (abs(being->getTileX() - localPlayer->getTileX()) > 1
|| abs(being->getTileY() - localPlayer->getTileY()) > 1)
@@ -227,11 +228,11 @@ static Being *findBeing(const std::string &name, const bool npc)
}
}
}
- if (!being && npc)
+ if ((being == nullptr) && npc)
{
being = actorManager->findNearestLivingBeing(
localPlayer, 1, ActorType::Player, AllowSort_true);
- if (being)
+ if (being != nullptr)
{
if (abs(being->getTileX() - localPlayer->getTileX()) > 1
|| abs(being->getTileY() - localPlayer->getTileY()) > 1)
@@ -267,7 +268,7 @@ static Item *getItemByInvIndex(const InputEvent &event,
default:
break;
}
- if (inv)
+ if (inv != nullptr)
return inv->getItem(index);
return nullptr;
}
@@ -278,7 +279,7 @@ static int getAmountFromEvent(const InputEvent &event,
{
Item *const item = getItemByInvIndex(event, invType);
item0 = item;
- if (!item)
+ if (item == nullptr)
return 0;
std::string str = event.args;
@@ -317,9 +318,9 @@ impHandler(emote)
const int emotion = 1 + (event.action - InputAction::EMOTE_1);
if (emotion > 0)
{
- if (emoteShortcut)
+ if (emoteShortcut != nullptr)
emoteShortcut->useEmotePlayer(emotion);
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -332,10 +333,10 @@ impHandler(outfit)
if (inputManager.isActionActive(InputAction::WEAR_OUTFIT))
{
const int num = event.action - InputAction::OUTFIT_1;
- if (outfitWindow && num >= 0)
+ if ((outfitWindow != nullptr) && num >= 0)
{
outfitWindow->wearOutfit(num);
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -343,10 +344,10 @@ impHandler(outfit)
else if (inputManager.isActionActive(InputAction::COPY_OUTFIT))
{
const int num = event.action - InputAction::OUTFIT_1;
- if (outfitWindow && num >= 0)
+ if ((outfitWindow != nullptr) && num >= 0)
{
outfitWindow->copyOutfit(num);
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -357,7 +358,7 @@ impHandler(outfit)
impHandler0(mouseClick)
{
- if (!guiInput || !gui)
+ if ((guiInput == nullptr) || (gui == nullptr))
return false;
int mouseX, mouseY;
@@ -369,13 +370,13 @@ impHandler0(mouseClick)
impHandler0(ok)
{
// Close the Browser if opened
- if (helpWindow && helpWindow->isWindowVisible())
+ if ((helpWindow != nullptr) && helpWindow->isWindowVisible())
{
helpWindow->setVisible(Visible_false);
return true;
}
// Close the config window, cancelling changes if opened
- else if (setupWindow && setupWindow->isWindowVisible())
+ else if ((setupWindow != nullptr) && setupWindow->isWindowVisible())
{
setupWindow->action(ActionEvent(nullptr, "cancel"));
return true;
@@ -394,12 +395,12 @@ impHandler0(ok)
impHandler(shortcut)
{
- if (itemShortcutWindow)
+ if (itemShortcutWindow != nullptr)
{
const int num = itemShortcutWindow->getTabIndex();
if (num >= 0 && num < CAST_S32(SHORTCUT_TABS))
{
- if (itemShortcut[num])
+ if (itemShortcut[num] != nullptr)
{
itemShortcut[num]->useItem(event.action
- InputAction::SHORTCUT_1);
@@ -412,14 +413,14 @@ impHandler(shortcut)
impHandler0(quit)
{
- if (!Game::instance())
+ if (Game::instance() == nullptr)
return false;
- if (popupManager && popupManager->isPopupMenuVisible())
+ if ((popupManager != nullptr) && popupManager->isPopupMenuVisible())
{
popupManager->closePopupMenu();
return true;
}
- else if (!quitDialog)
+ else if (quitDialog == nullptr)
{
CREATEWIDGETV(quitDialog, QuitDialog,
&quitDialog);
@@ -431,7 +432,7 @@ impHandler0(quit)
impHandler0(dropItem0)
{
- if (dropShortcut)
+ if (dropShortcut != nullptr)
{
dropShortcut->dropFirst();
return true;
@@ -441,7 +442,7 @@ impHandler0(dropItem0)
impHandler0(dropItem)
{
- if (dropShortcut)
+ if (dropShortcut != nullptr)
{
dropShortcut->dropItems();
return true;
@@ -452,14 +453,14 @@ impHandler0(dropItem)
impHandler(dropItemId)
{
const Inventory *const inv = PlayerInfo::getInventory();
- if (!inv)
+ if (inv == nullptr)
return false;
// +++ ignoring item color for now
Item *const item = inv->findItem(atoi(event.args.c_str()),
ItemColor_one);
- if (item && !PlayerInfo::isItemProtected(item->getId()))
+ if ((item != nullptr) && !PlayerInfo::isItemProtected(item->getId()))
{
ItemAmountWindow::showWindow(ItemAmountWindowUsage::ItemDrop,
inventoryWindow, item);
@@ -470,7 +471,7 @@ impHandler(dropItemId)
impHandler(dropItemInv)
{
Item *const item = getItemByInvIndex(event, InventoryType::Inventory);
- if (item && !PlayerInfo::isItemProtected(item->getId()))
+ if ((item != nullptr) && !PlayerInfo::isItemProtected(item->getId()))
{
ItemAmountWindow::showWindow(ItemAmountWindowUsage::ItemDrop,
inventoryWindow, item);
@@ -481,14 +482,14 @@ impHandler(dropItemInv)
impHandler(dropItemIdAll)
{
const Inventory *const inv = PlayerInfo::getInventory();
- if (!inv)
+ if (inv == nullptr)
return false;
// +++ ignoring item color for now
Item *const item = inv->findItem(atoi(event.args.c_str()),
ItemColor_one);
- if (item && !PlayerInfo::isItemProtected(item->getId()))
+ if ((item != nullptr) && !PlayerInfo::isItemProtected(item->getId()))
PlayerInfo::dropItem(item, item->getQuantity(), Sfx_true);
return true;
}
@@ -496,7 +497,7 @@ impHandler(dropItemIdAll)
impHandler(dropItemInvAll)
{
Item *const item = getItemByInvIndex(event, InventoryType::Inventory);
- if (item && !PlayerInfo::isItemProtected(item->getId()))
+ if ((item != nullptr) && !PlayerInfo::isItemProtected(item->getId()))
PlayerInfo::dropItem(item, item->getQuantity(), Sfx_true);
return true;
}
@@ -506,7 +507,8 @@ impHandler(heal)
{
if (Net::getNetworkType() != ServerType::TMWATHENA)
return false;
- if (actorManager && localPlayer)
+ if (actorManager != nullptr &&
+ localPlayer != nullptr)
{
std::string args = event.args;
@@ -517,14 +519,14 @@ impHandler(heal)
{
being = actorManager->findBeing(fromInt(atoi(
args.substr(1).c_str()), BeingId));
- if (being && being->getType() == ActorType::Monster)
+ if (being != nullptr && being->getType() == ActorType::Monster)
being = nullptr;
}
else
{
being = actorManager->findBeingByName(args, ActorType::Player);
}
- if (being)
+ if (being != nullptr)
actorManager->heal(being);
}
else
@@ -532,7 +534,8 @@ impHandler(heal)
Being *target = localPlayer->getTarget();
if (inputManager.isActionActive(InputAction::STOP_ATTACK))
{
- if (!target || target->getType() != ActorType::Player)
+ if (target == nullptr ||
+ target->getType() != ActorType::Player)
{
target = actorManager->findNearestLivingBeing(
localPlayer, 10, ActorType::Player, AllowSort_true);
@@ -540,13 +543,13 @@ impHandler(heal)
}
else
{
- if (!target)
+ if (target == nullptr)
target = localPlayer;
}
actorManager->heal(target);
}
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -565,7 +568,7 @@ impHandler0(healmd)
#ifdef TMWA_SUPPORT
if (Net::getNetworkType() != ServerType::TMWATHENA)
return false;
- if (actorManager)
+ if (actorManager != nullptr)
{
const int matk = PlayerInfo::getStatEffective(Attributes::PLAYER_MATK);
int maxHealingRadius;
@@ -582,10 +585,10 @@ impHandler0(healmd)
}
Being *target = actorManager->findMostDamagedPlayer(maxHealingRadius);
- if (target)
+ if (target != nullptr)
actorManager->heal(target);
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -599,9 +602,9 @@ impHandler0(itenplz)
#ifdef TMWA_SUPPORT
if (Net::getNetworkType() != ServerType::TMWATHENA)
return false;
- if (actorManager)
+ if (actorManager != nullptr)
{
- if (playerHandler &&
+ if (playerHandler != nullptr &&
playerHandler->canUseMagic() &&
PlayerInfo::getAttribute(Attributes::PLAYER_MP) >= 3)
{
@@ -616,7 +619,7 @@ impHandler0(itenplz)
impHandler0(setHome)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->setHome();
return true;
@@ -629,7 +632,7 @@ impHandler0(magicAttack)
#ifdef TMWA_SUPPORT
if (Net::getNetworkType() != ServerType::TMWATHENA)
return false;
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->magicAttack();
return true;
@@ -641,7 +644,7 @@ impHandler0(magicAttack)
impHandler0(copyEquippedToOutfit)
{
- if (outfitWindow)
+ if (outfitWindow != nullptr)
{
outfitWindow->copyFromEquiped();
return true;
@@ -651,7 +654,7 @@ impHandler0(copyEquippedToOutfit)
impHandler(pickup)
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return false;
const std::string args = event.args;
@@ -663,7 +666,7 @@ impHandler(pickup)
{
FloorItem *const item = actorManager->findItem(fromInt(
atoi(args.c_str()), BeingId));
- if (item)
+ if (item != nullptr)
localPlayer->pickUp(item);
}
return true;
@@ -679,7 +682,7 @@ static void doSit()
impHandler0(sit)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
doSit();
return true;
@@ -700,19 +703,19 @@ impHandler0(ignoreInput)
impHandler(buy)
{
- if (!serverFeatures)
+ if (serverFeatures == nullptr)
return false;
const std::string args = event.args;
Being *being = findBeing(args, false);
- if (!being && Net::getNetworkType() == ServerType::TMWATHENA)
+ if ((being == nullptr) && Net::getNetworkType() == ServerType::TMWATHENA)
{
- if (whoIsOnline)
+ if (whoIsOnline != nullptr)
{
const std::set<std::string> &players =
whoIsOnline->getOnlineNicks();
if (players.find(args) != players.end())
{
- if (buySellHandler)
+ if (buySellHandler != nullptr)
buySellHandler->requestSellList(args);
return true;
}
@@ -720,24 +723,29 @@ impHandler(buy)
return false;
}
- if (!being)
+ if (being == nullptr)
being = findBeing(args, true);
- if (!being)
+ if (being == nullptr)
return false;
if (being->getType() == ActorType::Npc)
{
- if (npcHandler)
+ if (npcHandler != nullptr)
npcHandler->buy(being);
return true;
}
else if (being->getType() == ActorType::Player)
{
- if (vendingHandler && Net::getNetworkType() != ServerType::TMWATHENA)
+ if (vendingHandler != nullptr &&
+ Net::getNetworkType() != ServerType::TMWATHENA)
+ {
vendingHandler->open(being);
- else if (buySellHandler)
+ }
+ else if (buySellHandler != nullptr)
+ {
buySellHandler->requestSellList(being->getName());
+ }
return true;
}
return false;
@@ -745,20 +753,21 @@ impHandler(buy)
impHandler(sell)
{
- if (!serverFeatures)
+ if (serverFeatures == nullptr)
return false;
const std::string args = event.args;
Being *being = findBeing(args, false);
- if (!being && Net::getNetworkType() == ServerType::TMWATHENA)
+ if (being == nullptr &&
+ Net::getNetworkType() == ServerType::TMWATHENA)
{
- if (whoIsOnline)
+ if (whoIsOnline != nullptr)
{
const std::set<std::string> &players =
whoIsOnline->getOnlineNicks();
if (players.find(args) != players.end())
{
- if (buySellHandler)
+ if (buySellHandler != nullptr)
buySellHandler->requestBuyList(args);
return true;
}
@@ -766,26 +775,26 @@ impHandler(sell)
return false;
}
- if (!being)
+ if (being == nullptr)
being = findBeing(args, true);
- if (!being)
+ if (being == nullptr)
return false;
if (being->getType() == ActorType::Npc)
{
- if (npcHandler)
+ if (npcHandler != nullptr)
npcHandler->sell(being->getId());
return true;
}
else if (being->getType() == ActorType::Player)
{
- if (buyingStoreHandler &&
+ if ((buyingStoreHandler != nullptr) &&
Net::getNetworkType() != ServerType::TMWATHENA)
{
buyingStoreHandler->open(being);
}
- else if (buySellHandler)
+ else if (buySellHandler != nullptr)
{
buySellHandler->requestBuyList(being->getName());
}
@@ -797,7 +806,7 @@ impHandler(sell)
impHandler(talk)
{
Being *being = findBeing(event.args, true);
- if (!being)
+ if (being == nullptr)
return false;
if (being->canTalk())
@@ -814,7 +823,7 @@ impHandler(talk)
impHandler0(stopAttack)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->stopAttack();
// not consume if target attack key pressed
@@ -827,7 +836,7 @@ impHandler0(stopAttack)
impHandler0(untarget)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->untarget();
return true;
@@ -837,7 +846,7 @@ impHandler0(untarget)
impHandler(attack)
{
- if (!localPlayer || !actorManager)
+ if ((localPlayer == nullptr) || (actorManager == nullptr))
return false;
Being *target = nullptr;
@@ -852,22 +861,25 @@ impHandler(attack)
{
target = actorManager->findBeing(fromInt(atoi(
args.substr(1).c_str()), BeingId));
- if (target && target->getType() != ActorType::Monster)
+ if (target != nullptr &&
+ target->getType() != ActorType::Monster)
+ {
target = nullptr;
+ }
}
}
- if (!target)
+ if (target == nullptr)
target = localPlayer->getTarget();
else
localPlayer->setTarget(target);
- if (target)
+ if (target != nullptr)
localPlayer->attack(target, true);
return true;
}
impHandler(targetAttack)
{
- if (localPlayer && actorManager)
+ if ((localPlayer != nullptr) && (actorManager != nullptr))
{
Being *target = nullptr;
std::string args = event.args;
@@ -884,15 +896,15 @@ impHandler(targetAttack)
{
target = actorManager->findBeing(fromInt(atoi(
args.substr(1).c_str()), BeingId));
- if (target && target->getType() != ActorType::Monster)
+ if ((target != nullptr) && target->getType() != ActorType::Monster)
target = nullptr;
}
}
- if (!target && !settings.targetingType)
+ if ((target == nullptr) && (settings.targetingType == 0u))
target = localPlayer->getTarget();
- if (!target)
+ if (target == nullptr)
{
target = actorManager->findNearestLivingBeing(
localPlayer, 90, ActorType::Monster, AllowSort_true);
@@ -906,11 +918,11 @@ impHandler(targetAttack)
impHandler0(attackHuman)
{
- if (!actorManager || !localPlayer)
+ if ((actorManager == nullptr) || (localPlayer == nullptr))
return false;
Being *const target = actorManager->findNearestPvpPlayer();
- if (target)
+ if (target != nullptr)
{
localPlayer->setTarget(target);
localPlayer->attack2(target, true);
@@ -927,13 +939,13 @@ impHandler0(safeVideoMode)
impHandler0(stopSit)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->stopAttack();
// not consume if target attack key pressed
if (inputManager.isActionActive(InputAction::TARGET_ATTACK))
return false;
- if (!localPlayer->getTarget())
+ if (localPlayer->getTarget() == nullptr)
{
doSit();
return true;
@@ -965,7 +977,7 @@ impHandler0(showKeyboard)
impHandler0(showWindows)
{
- if (popupMenu)
+ if (popupMenu != nullptr)
{
popupMenu->showWindowsPopup();
return true;
@@ -976,12 +988,12 @@ impHandler0(showWindows)
impHandler0(openTrade)
{
const Being *const being = localPlayer->getTarget();
- if (being && being->getType() == ActorType::Player)
+ if ((being != nullptr) && being->getType() == ActorType::Player)
{
- if (tradeHandler)
+ if (tradeHandler != nullptr)
tradeHandler->request(being);
tradePartnerName = being->getName();
- if (tradeWindow)
+ if (tradeWindow != nullptr)
tradeWindow->clear();
return true;
}
@@ -990,10 +1002,10 @@ impHandler0(openTrade)
impHandler0(ipcToggle)
{
- if (ipc)
+ if (ipc != nullptr)
{
IPC::stop();
- if (!ipc)
+ if (ipc == nullptr)
{
debugChatTab->chatLog("IPC service stopped.",
ChatMsgType::BY_SERVER);
@@ -1007,7 +1019,7 @@ impHandler0(ipcToggle)
else
{
IPC::start();
- if (ipc)
+ if (ipc != nullptr)
{
debugChatTab->chatLog(
strprintf("IPC service available on port %d", ipc->getPort()),
@@ -1025,7 +1037,7 @@ impHandler0(ipcToggle)
impHandler(where)
{
ChatTab *const tab = event.tab != nullptr ? event.tab : debugChatTab;
- if (!tab)
+ if (tab == nullptr)
return false;
std::ostringstream where;
where << Game::instance()->getCurrentMapName() << ", coordinates: "
@@ -1037,7 +1049,7 @@ impHandler(where)
impHandler0(who)
{
- if (chatHandler)
+ if (chatHandler != nullptr)
chatHandler->who();
return true;
}
@@ -1046,7 +1058,7 @@ impHandler0(cleanGraphics)
{
ResourceManager::clearCache();
- if (debugChatTab)
+ if (debugChatTab != nullptr)
{
// TRANSLATORS: clear graphics command message
debugChatTab->chatLog(_("Cache cleaned"),
@@ -1057,9 +1069,9 @@ impHandler0(cleanGraphics)
impHandler0(cleanFonts)
{
- if (gui)
+ if (gui != nullptr)
gui->clearFonts();
- if (debugChatTab)
+ if (debugChatTab != nullptr)
{
// TRANSLATORS: clear fonts cache message
debugChatTab->chatLog(_("Cache cleaned"),
@@ -1070,19 +1082,19 @@ impHandler0(cleanFonts)
impHandler(trade)
{
- if (!actorManager)
+ if (actorManager == nullptr)
return false;
const Being *being = actorManager->findBeingByName(
event.args, ActorType::Player);
- if (!being)
+ if (being == nullptr)
being = localPlayer->getTarget();
- if (being)
+ if (being != nullptr)
{
- if (tradeHandler)
+ if (tradeHandler != nullptr)
tradeHandler->request(being);
tradePartnerName = being->getName();
- if (tradeWindow)
+ if (tradeWindow != nullptr)
tradeWindow->clear();
}
return true;
@@ -1090,7 +1102,7 @@ impHandler(trade)
impHandler0(priceLoad)
{
- if (shopWindow)
+ if (shopWindow != nullptr)
{
shopWindow->loadList();
return true;
@@ -1100,7 +1112,7 @@ impHandler0(priceLoad)
impHandler0(priceSave)
{
- if (shopWindow)
+ if (shopWindow != nullptr)
{
shopWindow->saveList();
return true;
@@ -1110,7 +1122,7 @@ impHandler0(priceSave)
impHandler0(cacheInfo)
{
- if (!chatWindow || !debugChatTab)
+ if ((chatWindow == nullptr) || (debugChatTab == nullptr))
return false;
/*
@@ -1156,14 +1168,14 @@ impHandler0(cacheInfo)
impHandler0(disconnect)
{
- if (gameHandler)
+ if (gameHandler != nullptr)
gameHandler->disconnect2();
return true;
}
impHandler(undress)
{
- if (!actorManager || !localPlayer)
+ if ((actorManager == nullptr) || (localPlayer == nullptr))
return false;
const std::string args = event.args;
@@ -1182,7 +1194,7 @@ impHandler(undress)
{
target = actorManager->findBeing(fromInt(atoi(
pars[0].substr(1).c_str()), BeingId));
- if (target && target->getType() == ActorType::Monster)
+ if ((target != nullptr) && target->getType() == ActorType::Monster)
target = nullptr;
}
else
@@ -1194,12 +1206,12 @@ impHandler(undress)
if (sz == 2)
{
const int itemId = atoi(pars[1].c_str());
- if (target)
+ if (target != nullptr)
target->undressItemById(itemId);
}
else
{
- if (target && beingHandler)
+ if ((target != nullptr) && (beingHandler != nullptr))
beingHandler->undress(target);
}
@@ -1208,7 +1220,7 @@ impHandler(undress)
impHandler0(dirs)
{
- if (!debugChatTab)
+ if (debugChatTab == nullptr)
return false;
debugChatTab->chatLog("config directory: "
@@ -1228,7 +1240,7 @@ impHandler0(dirs)
impHandler0(uptime)
{
- if (!debugChatTab)
+ if (debugChatTab == nullptr)
return false;
if (cur_time < start_time)
@@ -1333,14 +1345,14 @@ impHandler0(dump)
impHandler0(serverIgnoreAll)
{
- if (chatHandler)
+ if (chatHandler != nullptr)
chatHandler->ignoreAll();
return true;
}
impHandler0(serverUnIgnoreAll)
{
- if (chatHandler)
+ if (chatHandler != nullptr)
chatHandler->unIgnoreAll();
return true;
}
@@ -1401,10 +1413,10 @@ impHandler(dumpGraphics)
impHandler0(dumpEnvironment)
{
logger->log1("Start environment variables");
- for (char **env = environ; *env; ++ env)
+ for (char **env = environ; *env != nullptr; ++ env)
logger->log1(*env);
logger->log1("End environment variables");
- if (debugChatTab)
+ if (debugChatTab != nullptr)
{
// TRANSLATORS: dump environment command
debugChatTab->chatLog(_("Environment variables dumped"),
@@ -1508,7 +1520,7 @@ impHandler0(createItems)
FOR_EACH (ItemDB::ItemInfos::const_iterator, it, items)
{
const ItemInfo *const info = (*it).second;
- if (!info)
+ if (info == nullptr)
continue;
const int id = info->getId();
if (id <= 500)
@@ -1529,7 +1541,7 @@ impHandler(createItem)
int id = 0;
int amount = 0;
- if (!adminHandler)
+ if (adminHandler == nullptr)
return false;
if (parse2Int(event.args, id, amount))
@@ -1571,7 +1583,7 @@ impHandler(uploadLog)
impHandler0(mercenaryFire)
{
- if (mercenaryHandler)
+ if (mercenaryHandler != nullptr)
mercenaryHandler->fire();
return true;
}
@@ -1583,7 +1595,7 @@ impHandler(useItem)
if (itemId < SPELL_MIN_ID)
{
const Inventory *const inv = PlayerInfo::getInventory();
- if (inv)
+ if (inv != nullptr)
{
// +++ ignoring item color for now
const Item *const item = inv->findItem(itemId,
@@ -1591,11 +1603,11 @@ impHandler(useItem)
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)
{
// +++ probably need get data parameter from args
skillDialog->useItem(itemId,
@@ -1618,11 +1630,11 @@ impHandler(invToStorage)
Item *item = nullptr;
const int amount = getAmountFromEvent(event, item,
InventoryType::Inventory);
- if (!item)
+ if (item == nullptr)
return true;
- if (amount)
+ if (amount != 0)
{
- if (inventoryHandler)
+ if (inventoryHandler != nullptr)
{
inventoryHandler->moveItem2(InventoryType::Inventory,
item->getInvIndex(),
@@ -1643,12 +1655,12 @@ impHandler(tradeAdd)
Item *item = nullptr;
const int amount = getAmountFromEvent(event, item,
InventoryType::Inventory);
- if (!item || PlayerInfo::isItemProtected(item->getId()))
+ if ((item == nullptr) || PlayerInfo::isItemProtected(item->getId()))
return true;
- if (amount)
+ if (amount != 0)
{
- if (tradeWindow)
+ if (tradeWindow != nullptr)
tradeWindow->tradeItem(item, amount, true);
}
else
@@ -1663,9 +1675,9 @@ impHandler(storageToInv)
{
Item *item = nullptr;
const int amount = getAmountFromEvent(event, item, InventoryType::Storage);
- if (amount)
+ if (amount != 0)
{
- if (inventoryHandler && item)
+ if ((inventoryHandler != nullptr) && (item != nullptr))
{
inventoryHandler->moveItem2(InventoryType::Storage,
item->getInvIndex(),
@@ -1699,7 +1711,7 @@ impHandler(unprotectItem)
impHandler(kick)
{
- if (!localPlayer || !actorManager)
+ if ((localPlayer == nullptr) || (actorManager == nullptr))
return false;
Being *target = nullptr;
@@ -1716,23 +1728,23 @@ impHandler(kick)
args.substr(1).c_str()), BeingId));
}
}
- if (!target)
+ if (target == nullptr)
target = localPlayer->getTarget();
- if (target && adminHandler)
+ if ((target != nullptr) && (adminHandler != nullptr))
adminHandler->kick(target->getId());
return true;
}
impHandler0(clearDrop)
{
- if (dropShortcut)
+ if (dropShortcut != nullptr)
dropShortcut->clear();
return true;
}
impHandler0(testInfo)
{
- if (actorManager)
+ if (actorManager != nullptr)
{
logger->log("actors count: %d", CAST_S32(
actorManager->size()));
@@ -1746,7 +1758,7 @@ impHandler(craftKey)
const int slot = (event.action - InputAction::CRAFT_1);
if (slot >= 0 && slot < 9)
{
- if (inventoryWindow)
+ if (inventoryWindow != nullptr)
inventoryWindow->moveItemToCraft(slot);
return true;
}
@@ -1761,7 +1773,7 @@ impHandler0(resetGameModifiers)
impHandler(barToChat)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->addInputText(event.args);
return true;
@@ -1771,13 +1783,13 @@ impHandler(barToChat)
impHandler(seen)
{
- if (!actorManager)
+ if (actorManager == nullptr)
return false;
ChatTab *tab = event.tab;
- if (!tab)
+ if (tab == nullptr)
tab = localChatTab;
- if (!tab)
+ if (tab == nullptr)
return false;
if (config.getBoolValue("enableIdCollecting") == false)
@@ -1825,7 +1837,7 @@ impHandler(seen)
impHandler(dumpMemoryUsage)
{
- if (event.tab)
+ if (event.tab != nullptr)
memoryManager.printAllMemory(event.tab);
else
memoryManager.printAllMemory(localChatTab);
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index 4f69b31b8..99d847c39 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -65,9 +65,9 @@ static void outString(ChatTab *const tab,
const std::string &str,
const std::string &def)
{
- if (!tab)
+ if (tab == nullptr)
{
- if (chatHandler)
+ if (chatHandler != nullptr)
chatHandler->talk(def, GENERAL_CHANNEL);
return;
}
@@ -76,16 +76,16 @@ static void outString(ChatTab *const tab,
{
case ChatTabType::PARTY:
{
- if (partyHandler)
+ if (partyHandler != nullptr)
partyHandler->chat(str);
break;
}
case ChatTabType::GUILD:
{
- if (!guildHandler || !localPlayer)
+ if ((guildHandler == nullptr) || (localPlayer == nullptr))
return;
const Guild *const guild = localPlayer->getGuild();
- if (guild)
+ if (guild != nullptr)
{
#ifdef TMWA_SUPPORT
if (guild->getServerGuild())
@@ -94,7 +94,7 @@ static void outString(ChatTab *const tab,
return;
guildHandler->chat(str);
}
- else if (guildManager)
+ else if (guildManager != nullptr)
{
guildManager->chat(str);
}
@@ -118,7 +118,7 @@ static void outString(ChatTab *const tab,
case ChatTabType::DEBUG:
case ChatTabType::BATTLE:
case ChatTabType::LANG:
- if (chatHandler)
+ if (chatHandler != nullptr)
chatHandler->talk(str, GENERAL_CHANNEL);
break;
}
@@ -126,12 +126,12 @@ static void outString(ChatTab *const tab,
impHandler0(toggleChat)
{
- return chatWindow ? chatWindow->requestChatFocus() : false;
+ return chatWindow != nullptr ? chatWindow->requestChatFocus() : false;
}
impHandler0(prevChatTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->prevTab();
return true;
@@ -141,7 +141,7 @@ impHandler0(prevChatTab)
impHandler0(nextChatTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->nextTab();
return true;
@@ -151,7 +151,7 @@ impHandler0(nextChatTab)
impHandler0(closeChatTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->closeTab();
return true;
@@ -161,7 +161,7 @@ impHandler0(closeChatTab)
impHandler0(closeAllChatTabs)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->removeAllWhispers();
chatWindow->saveState();
@@ -172,7 +172,7 @@ impHandler0(closeAllChatTabs)
impHandler0(ignoreAllWhispers)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->ignoreAllWhispers();
chatWindow->saveState();
@@ -183,7 +183,7 @@ impHandler0(ignoreAllWhispers)
impHandler0(scrollChatUp)
{
- if (chatWindow && chatWindow->isWindowVisible())
+ if ((chatWindow != nullptr) && chatWindow->isWindowVisible())
{
chatWindow->scroll(-DEFAULT_CHAT_WINDOW_SCROLL);
return true;
@@ -193,7 +193,7 @@ impHandler0(scrollChatUp)
impHandler0(scrollChatDown)
{
- if (chatWindow && chatWindow->isWindowVisible())
+ if ((chatWindow != nullptr) && chatWindow->isWindowVisible())
{
chatWindow->scroll(DEFAULT_CHAT_WINDOW_SCROLL);
return true;
@@ -256,10 +256,10 @@ impHandler(msg)
if (splitWhisper(event.args, recvnick, message))
{
- if (!chatWindow)
+ if (chatWindow == nullptr)
return false;
ChatTab *const tab = chatWindow->addChatTab(recvnick, false, true);
- if (tab)
+ if (tab != nullptr)
{
chatWindow->saveState();
tab->chatInput(message);
@@ -267,7 +267,7 @@ impHandler(msg)
}
else
{
- if (event.tab)
+ if (event.tab != nullptr)
{
event.tab->chatLog(
// TRANSLATORS: whisper send
@@ -280,7 +280,7 @@ impHandler(msg)
impHandler(msgText)
{
- if (!chatWindow)
+ if (chatWindow == nullptr)
return false;
if (config.getBoolValue("whispertab"))
@@ -300,7 +300,7 @@ impHandler(msg2)
std::string recvnick;
std::string message;
- if (chatHandler && splitWhisper(event.args, recvnick, message))
+ if ((chatHandler != nullptr) && splitWhisper(event.args, recvnick, message))
chatHandler->privateMessage(recvnick, message);
return true;
}
@@ -308,16 +308,16 @@ impHandler(msg2)
impHandler(query)
{
const std::string &args = event.args;
- if (chatWindow)
+ if (chatWindow != nullptr)
{
- if (chatWindow->addChatTab(args, true, true))
+ if (chatWindow->addChatTab(args, true, true) != nullptr)
{
chatWindow->saveState();
return true;
}
}
- if (event.tab)
+ if (event.tab != nullptr)
{
// TRANSLATORS: new whisper or channel query
event.tab->chatLog(strprintf(_("Cannot create a whisper tab "
@@ -329,7 +329,7 @@ impHandler(query)
impHandler0(clearChatTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->clearTab();
return true;
@@ -339,7 +339,7 @@ impHandler0(clearChatTab)
impHandler(createParty)
{
- if (!partyHandler)
+ if (partyHandler == nullptr)
return false;
if (event.args.empty())
@@ -358,7 +358,7 @@ impHandler(createParty)
impHandler(createGuild)
{
- if (!guildHandler ||
+ if ((guildHandler == nullptr) ||
Net::getNetworkType() == ServerType::TMWATHENA)
{
return false;
@@ -382,12 +382,12 @@ impHandler(party)
{
if (!event.args.empty())
{
- if (partyHandler)
+ if (partyHandler != nullptr)
partyHandler->invite(event.args);
}
else
{
- if (event.tab)
+ if (event.tab != nullptr)
{
// TRANSLATORS: party invite message
event.tab->chatLog(_("Please specify a name."),
@@ -399,19 +399,19 @@ impHandler(party)
impHandler(guild)
{
- if (!guildHandler || !localPlayer)
+ if ((guildHandler == nullptr) || (localPlayer == nullptr))
return false;
const std::string args = event.args;
if (!args.empty())
{
const Guild *const guild = localPlayer->getGuild();
- if (guild)
+ if (guild != nullptr)
{
#ifdef TMWA_SUPPORT
if (guild->getServerGuild())
guildHandler->invite(args);
- else if (guildManager)
+ else if (guildManager != nullptr)
guildManager->invite(args);
#else // TMWA_SUPPORT
@@ -421,13 +421,13 @@ impHandler(guild)
}
else
{
- if (event.tab)
+ if (event.tab != nullptr)
{
// TRANSLATORS: guild invite message
event.tab->chatLog(_("Please specify a name."),
ChatMsgType::BY_SERVER);
}
- else if (localChatTab)
+ else if (localChatTab != nullptr)
{
// TRANSLATORS: guild invite message
localChatTab->chatLog(_("Please specify a name."),
@@ -447,7 +447,7 @@ impHandler(toggle)
{
if (event.args.empty())
{
- if (chatWindow && event.tab)
+ if ((chatWindow != nullptr) && (event.tab != nullptr))
{
event.tab->chatLog(chatWindow->getReturnTogglesChat() ?
// TRANSLATORS: message from toggle chat command
@@ -460,27 +460,27 @@ impHandler(toggle)
switch (parseBoolean(event.args))
{
case 1:
- if (event.tab)
+ if (event.tab != nullptr)
{
// TRANSLATORS: message from toggle chat command
event.tab->chatLog(_("Return now toggles chat."),
ChatMsgType::BY_SERVER);
}
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->setReturnTogglesChat(true);
return true;
case 0:
- if (event.tab)
+ if (event.tab != nullptr)
{
// TRANSLATORS: message from toggle chat command
event.tab->chatLog(_("Message now closes chat."),
ChatMsgType::BY_SERVER);
}
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->setReturnTogglesChat(false);
return true;
case -1:
- if (event.tab)
+ if (event.tab != nullptr)
{
event.tab->chatLog(strprintf(BOOLEAN_OPTIONS, "toggle"),
ChatMsgType::BY_SERVER);
@@ -495,12 +495,12 @@ impHandler(kickParty)
{
if (!event.args.empty())
{
- if (partyHandler)
+ if (partyHandler != nullptr)
partyHandler->kick(event.args);
}
else
{
- if (event.tab)
+ if (event.tab != nullptr)
{
// TRANSLATORS: party kick message
event.tab->chatLog(_("Please specify a name."),
@@ -514,18 +514,18 @@ impHandler(kickGuild)
{
if (!event.args.empty())
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
const Guild *const guild = localPlayer->getGuild();
- if (guild)
+ if (guild != nullptr)
{
if (guild->getServerGuild())
{
- if (guildHandler)
+ if (guildHandler != nullptr)
guildHandler->kick(guild->getMember(event.args), "");
}
#ifdef TMWA_SUPPORT
- else if (guildManager)
+ else if (guildManager != nullptr)
{
guildManager->kick(event.args);
}
@@ -535,7 +535,7 @@ impHandler(kickGuild)
}
else
{
- if (event.tab)
+ if (event.tab != nullptr)
{
// TRANSLATORS: party kick message
event.tab->chatLog(_("Please specify a name."),
@@ -547,77 +547,77 @@ impHandler(kickGuild)
impHandler(addText)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->addInputText(event.args);
return true;
}
impHandler0(clearChat)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->clearTab();
return true;
}
impHandler0(chatGeneralTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->selectTabByType(ChatTabType::INPUT);
return true;
}
impHandler0(chatDebugTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->selectTabByType(ChatTabType::DEBUG);
return true;
}
impHandler0(chatBattleTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->selectTabByType(ChatTabType::BATTLE);
return true;
}
impHandler0(chatTradeTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->selectTabByType(ChatTabType::TRADE);
return true;
}
impHandler0(chatLangTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->selectTabByType(ChatTabType::LANG);
return true;
}
impHandler0(chatGmTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->selectTabByType(ChatTabType::GM);
return true;
}
impHandler0(chatPartyTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->selectTabByType(ChatTabType::PARTY);
return true;
}
impHandler0(chatGuildTab)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->selectTabByType(ChatTabType::GUILD);
return true;
}
impHandler(hat)
{
- if (!localPlayer || !charServerHandler)
+ if ((localPlayer == nullptr) || (charServerHandler == nullptr))
return false;
const int sprite = localPlayer->getSpriteID(
@@ -644,7 +644,7 @@ impHandler(chatClipboard)
int x = 0;
int y = 0;
- if (chatWindow && parse2Int(event.args, x, y))
+ if ((chatWindow != nullptr) && parse2Int(event.args, x, y))
{
chatWindow->copyToClipboard(x, y);
return true;
@@ -654,7 +654,7 @@ impHandler(chatClipboard)
impHandler(guildNotice)
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return false;
const std::string args = event.args;
if (args.empty())
@@ -671,7 +671,7 @@ impHandler(guildNotice)
if (args.size() > 60)
str2 = args.substr(60);
const Guild *const guild = localPlayer->getGuild();
- if (guild)
+ if (guild != nullptr)
guildHandler->changeNotice(guild->getId(), str1, str2);
return true;
}
@@ -721,7 +721,7 @@ impHandler(translate)
impHandler(sendGuiKey)
{
- if (!guiInput)
+ if (guiInput == nullptr)
return false;
const std::string args = event.args;
@@ -755,7 +755,7 @@ impHandler(sendGuiKey)
impHandler(sendMouseKey)
{
- if (!guiInput)
+ if (guiInput == nullptr)
return false;
const std::string args = event.args;
if (args.empty())
@@ -782,7 +782,7 @@ impHandler(sendMouseKey)
impHandler(sendChars)
{
- if (!guiInput)
+ if (guiInput == nullptr)
return false;
const std::string args = event.args;
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index bb7e37d87..bad59ec29 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -88,8 +88,11 @@ static std::string getNick(const InputEvent &event)
std::string args = event.args;
if (args.empty())
{
- if (!event.tab || event.tab->getType() != ChatTabType::WHISPER)
+ if (event.tab == nullptr ||
+ event.tab->getType() != ChatTabType::WHISPER)
+ {
return std::string();
+ }
WhisperTab *const whisper = static_cast<WhisperTab *>(event.tab);
if (whisper->getNick().empty())
@@ -109,7 +112,7 @@ static void reportRelation(const InputEvent &event,
const std::string &str1,
const std::string &str2)
{
- if (event.tab)
+ if (event.tab != nullptr)
{
if (player_relations.getRelation(event.args) == rel)
{
@@ -134,7 +137,7 @@ static void changeRelation(const InputEvent &event,
if (player_relations.getRelation(args) == relation)
{
- if (event.tab)
+ if (event.tab != nullptr)
{
// TRANSLATORS: change relation
event.tab->chatLog(strprintf(_("Player already %s!"),
@@ -157,7 +160,7 @@ static void changeRelation(const InputEvent &event,
impHandler(chatAnnounce)
{
- if (adminHandler)
+ if (adminHandler != nullptr)
{
adminHandler->announce(event.args);
return true;
@@ -184,7 +187,7 @@ impHandler(chatUnignore)
}
else
{
- if (event.tab)
+ if (event.tab != nullptr)
{
// TRANSLATORS: unignore command
event.tab->chatLog(_("Player wasn't ignored!"),
@@ -210,7 +213,7 @@ impHandler(chatErase)
if (player_relations.getRelation(args) == Relation::ERASED)
{
- if (event.tab)
+ if (event.tab != nullptr)
{
// TRANSLATORS: erase command
event.tab->chatLog(_("Player already erased!"),
@@ -269,13 +272,13 @@ impHandler(chatEnemy)
impHandler(chatNuke)
{
- if (!actorManager)
+ if (actorManager == nullptr)
return false;
const std::string nick = getNick(event);
Being *const being = actorManager->findBeingByName(
nick, ActorType::Player);
- if (!being)
+ if (being == nullptr)
return true;
actorManager->addBlock(being->getId());
@@ -285,7 +288,7 @@ impHandler(chatNuke)
impHandler(chatAdd)
{
- if (!chatWindow)
+ if (chatWindow == nullptr)
return false;
if (event.args.empty())
@@ -311,7 +314,7 @@ impHandler(chatAdd)
const FloorItem *const floorItem = actorManager->findItem(
fromInt(id, BeingId));
- if (floorItem)
+ if (floorItem != nullptr)
{
str[0] = floorItem->getItemId();
const std::string names = ItemDB::getNamesStr(str);
@@ -322,7 +325,7 @@ impHandler(chatAdd)
impHandler0(present)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->doPresent();
return true;
@@ -332,7 +335,7 @@ impHandler0(present)
impHandler0(printAll)
{
- if (actorManager)
+ if (actorManager != nullptr)
{
actorManager->printAllToChat();
return true;
@@ -345,7 +348,7 @@ impHandler(move)
int x = 0;
int y = 0;
- if (localPlayer && parse2Int(event.args, x, y))
+ if ((localPlayer != nullptr) && parse2Int(event.args, x, y))
{
localPlayer->setDestination(x, y);
return true;
@@ -355,18 +358,18 @@ impHandler(move)
impHandler(setTarget)
{
- if (!actorManager || !localPlayer)
+ if ((actorManager == nullptr) || (localPlayer == nullptr))
return false;
Being *const target = actorManager->findNearestByName(event.args);
- if (target)
+ if (target != nullptr)
localPlayer->setTarget(target);
return true;
}
impHandler(commandOutfit)
{
- if (outfitWindow)
+ if (outfitWindow != nullptr)
{
if (!event.args.empty())
{
@@ -397,7 +400,7 @@ impHandler(commandOutfit)
impHandler(commandEmote)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->emote(CAST_U8(atoi(event.args.c_str())));
return true;
@@ -407,7 +410,7 @@ impHandler(commandEmote)
impHandler(awayMessage)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->setAway(event.args);
return true;
@@ -417,7 +420,7 @@ impHandler(awayMessage)
impHandler(pseudoAway)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->setPseudoAway(event.args);
localPlayer->updateStatus();
@@ -428,7 +431,7 @@ impHandler(pseudoAway)
impHandler(follow)
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return false;
if (!features.getBoolValue("allowFollow"))
@@ -438,7 +441,8 @@ impHandler(follow)
{
localPlayer->setFollow(event.args);
}
- else if (event.tab && event.tab->getType() == ChatTabType::WHISPER)
+ else if (event.tab != nullptr &&
+ event.tab->getType() == ChatTabType::WHISPER)
{
localPlayer->setFollow(static_cast<WhisperTab*>(event.tab)->getNick());
}
@@ -453,7 +457,7 @@ impHandler(follow)
impHandler(navigate)
{
- if (!localPlayer ||
+ if ((localPlayer == nullptr) ||
!localPlayer->canMove())
{
return false;
@@ -471,7 +475,7 @@ impHandler(navigate)
impHandler(navigateTo)
{
- if (!localPlayer ||
+ if ((localPlayer == nullptr) ||
!localPlayer->canMove())
{
return false;
@@ -482,20 +486,24 @@ impHandler(navigateTo)
return true;
Being *const being = actorManager->findBeingByName(args);
- if (being)
+ if (being != nullptr)
{
localPlayer->navigateTo(being->getTileX(), being->getTileY());
}
else if (localPlayer->isInParty())
{
const Party *const party = localPlayer->getParty();
- if (party)
+ if (party != nullptr)
{
const PartyMember *const m = party->getMember(args);
const PartyMember *const o = party->getMember(
localPlayer->getName());
- if (m && o && m->getMap() == o->getMap())
+ if (m != nullptr &&
+ o != nullptr &&
+ m->getMap() == o->getMap())
+ {
localPlayer->navigateTo(m->getX(), m->getY());
+ }
}
}
return true;
@@ -506,7 +514,7 @@ impHandler(moveCamera)
int x = 0;
int y = 0;
- if (!viewport)
+ if (viewport == nullptr)
return false;
if (parse2Int(event.args, x, y))
@@ -516,7 +524,7 @@ impHandler(moveCamera)
impHandler0(restoreCamera)
{
- if (!viewport)
+ if (viewport == nullptr)
return false;
viewport->returnCamera();
@@ -525,14 +533,15 @@ impHandler0(restoreCamera)
impHandler(imitation)
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return false;
if (!event.args.empty())
{
localPlayer->setImitate(event.args);
}
- else if (event.tab && event.tab->getType() == ChatTabType::WHISPER)
+ else if (event.tab != nullptr &&
+ event.tab->getType() == ChatTabType::WHISPER)
{
localPlayer->setImitate(static_cast<WhisperTab*>(
event.tab)->getNick());
@@ -568,19 +577,19 @@ impHandler(sendMail)
impHandler(info)
{
- if (!event.tab ||
- !localPlayer ||
+ if ((event.tab == nullptr) ||
+ (localPlayer == nullptr) ||
Net::getNetworkType() == ServerType::TMWATHENA)
{
return false;
}
- if (event.tab &&
- guildHandler &&
+ if ((event.tab != nullptr) &&
+ (guildHandler != nullptr) &&
event.tab->getType() == ChatTabType::GUILD)
{
const Guild *const guild = localPlayer->getGuild();
- if (guild)
+ if (guild != nullptr)
guildHandler->info();
}
return true;
@@ -588,7 +597,7 @@ impHandler(info)
impHandler(wait)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->waitFor(event.args);
return true;
@@ -598,7 +607,7 @@ impHandler(wait)
impHandler(addPriorityAttack)
{
- if (!actorManager ||
+ if ((actorManager == nullptr) ||
actorManager->isInPriorityAttackList(event.args))
{
return false;
@@ -607,27 +616,27 @@ impHandler(addPriorityAttack)
actorManager->removeAttackMob(event.args);
actorManager->addPriorityAttackMob(event.args);
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updateAttackFilter();
return true;
}
impHandler(addAttack)
{
- if (!actorManager)
+ if (actorManager == nullptr)
return false;
actorManager->removeAttackMob(event.args);
actorManager->addAttackMob(event.args);
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updateAttackFilter();
return true;
}
impHandler(removeAttack)
{
- if (!actorManager)
+ if (actorManager == nullptr)
return false;
if (event.args.empty())
@@ -649,20 +658,20 @@ impHandler(removeAttack)
}
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updateAttackFilter();
return true;
}
impHandler(addIgnoreAttack)
{
- if (!actorManager)
+ if (actorManager == nullptr)
return false;
actorManager->removeAttackMob(event.args);
actorManager->addIgnoreAttackMob(event.args);
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updateAttackFilter();
return true;
}
@@ -675,7 +684,7 @@ impHandler(setDrop)
impHandler(url)
{
- if (event.tab)
+ if (event.tab != nullptr)
{
std::string url1 = event.args;
if (!strStartWith(url1, "http") && !strStartWith(url1, "?"))
@@ -717,10 +726,10 @@ impHandler(execute)
impHandler(enableHighlight)
{
- if (event.tab)
+ if (event.tab != nullptr)
{
event.tab->setAllowHighlight(true);
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->saveState();
return true;
@@ -731,10 +740,10 @@ impHandler(enableHighlight)
impHandler(disableHighlight)
{
- if (event.tab)
+ if (event.tab != nullptr)
{
event.tab->setAllowHighlight(false);
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->saveState();
return true;
@@ -745,10 +754,10 @@ impHandler(disableHighlight)
impHandler(dontRemoveName)
{
- if (event.tab)
+ if (event.tab != nullptr)
{
event.tab->setRemoveNames(false);
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->saveState();
return true;
@@ -759,10 +768,10 @@ impHandler(dontRemoveName)
impHandler(removeName)
{
- if (event.tab)
+ if (event.tab != nullptr)
{
event.tab->setRemoveNames(true);
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->saveState();
return true;
@@ -773,10 +782,10 @@ impHandler(removeName)
impHandler(disableAway)
{
- if (event.tab)
+ if (event.tab != nullptr)
{
event.tab->setNoAway(true);
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->saveState();
return true;
@@ -787,10 +796,10 @@ impHandler(disableAway)
impHandler(enableAway)
{
- if (event.tab)
+ if (event.tab != nullptr)
{
event.tab->setNoAway(false);
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->saveState();
return true;
@@ -801,7 +810,7 @@ impHandler(enableAway)
impHandler(testParticle)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->setTestParticle(event.args);
return true;
@@ -811,7 +820,7 @@ impHandler(testParticle)
impHandler(talkRaw)
{
- if (chatHandler)
+ if (chatHandler != nullptr)
{
chatHandler->talkRaw(event.args);
return true;
@@ -821,7 +830,7 @@ impHandler(talkRaw)
impHandler(gm)
{
- if (chatHandler)
+ if (chatHandler != nullptr)
{
Gm::runCommand("wgm", event.args);
return true;
@@ -831,7 +840,7 @@ impHandler(gm)
impHandler(hack)
{
- if (chatHandler)
+ if (chatHandler != nullptr)
{
chatHandler->sendRaw(event.args);
return true;
@@ -841,7 +850,7 @@ impHandler(hack)
impHandler(debugSpawn)
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return false;
int cnt = atoi(event.args.c_str());
if (cnt < 1)
@@ -871,7 +880,7 @@ impHandler(serverIgnoreWhisper)
if (args.empty())
return false;
- if (chatHandler)
+ if (chatHandler != nullptr)
{
chatHandler->ignore(args);
return true;
@@ -885,7 +894,7 @@ impHandler(serverUnIgnoreWhisper)
if (args.empty())
return false;
- if (chatHandler)
+ if (chatHandler != nullptr)
{
chatHandler->unIgnore(args);
return true;
@@ -899,7 +908,7 @@ impHandler(setHomunculusName)
if (args.empty())
{
const HomunculusInfo *const info = PlayerInfo::getHomunculus();
- if (info)
+ if (info != nullptr)
{
// TRANSLATORS: dialog header
inputActionReplayListener.openDialog(_("Rename your homun"),
@@ -909,7 +918,7 @@ impHandler(setHomunculusName)
return false;
}
- if (homunculusHandler)
+ if (homunculusHandler != nullptr)
{
homunculusHandler->setName(args);
return true;
@@ -919,7 +928,7 @@ impHandler(setHomunculusName)
impHandler0(fireHomunculus)
{
- if (homunculusHandler)
+ if (homunculusHandler != nullptr)
{
homunculusHandler->fire();
return true;
@@ -929,7 +938,7 @@ impHandler0(fireHomunculus)
impHandler0(leaveParty)
{
- if (partyHandler)
+ if (partyHandler != nullptr)
{
partyHandler->leave();
return true;
@@ -939,10 +948,10 @@ impHandler0(leaveParty)
impHandler0(leaveGuild)
{
- if (guildHandler && localPlayer)
+ if ((guildHandler != nullptr) && (localPlayer != nullptr))
{
const Guild *const guild = localPlayer->getGuild();
- if (guild)
+ if (guild != nullptr)
guildHandler->leave(guild->getId());
return true;
}
@@ -954,8 +963,8 @@ impHandler(warp)
int x = 0;
int y = 0;
- if (adminHandler &&
- Game::instance() &&
+ if ((adminHandler != nullptr) &&
+ (Game::instance() != nullptr) &&
parse2Int(event.args, x, y))
{
adminHandler->warp(Game::instance()->getCurrentMapName(),
@@ -967,13 +976,13 @@ impHandler(warp)
impHandler(homunTalk)
{
- if (!serverFeatures || !serverFeatures->haveTalkPet())
+ if ((serverFeatures == nullptr) || !serverFeatures->haveTalkPet())
return false;
std::string args = event.args;
if (findCutFirst(args, "/me "))
args = textToMe(args);
- if (homunculusHandler)
+ if (homunculusHandler != nullptr)
{
homunculusHandler->talk(args);
return true;
@@ -983,17 +992,17 @@ impHandler(homunTalk)
impHandler(homunEmote)
{
- if (!serverFeatures || !serverFeatures->haveTalkPet())
+ if ((serverFeatures == nullptr) || !serverFeatures->haveTalkPet())
return false;
- if (homunculusHandler &&
+ if ((homunculusHandler != nullptr) &&
event.action >= InputAction::HOMUN_EMOTE_1 &&
event.action <= InputAction::HOMUN_EMOTE_48)
{
const int emotion = event.action - InputAction::HOMUN_EMOTE_1;
- if (emoteShortcut)
+ if (emoteShortcut != nullptr)
homunculusHandler->emote(emoteShortcut->getEmote(emotion));
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -1003,10 +1012,10 @@ impHandler(homunEmote)
impHandler(commandHomunEmote)
{
- if (!serverFeatures || !serverFeatures->haveTalkPet())
+ if ((serverFeatures == nullptr) || !serverFeatures->haveTalkPet())
return false;
- if (homunculusHandler)
+ if (homunculusHandler != nullptr)
{
homunculusHandler->emote(CAST_U8(
atoi(event.args.c_str())));
@@ -1017,7 +1026,7 @@ impHandler(commandHomunEmote)
impHandler(createPublicChatRoom)
{
- if (!chatHandler || event.args.empty())
+ if ((chatHandler == nullptr) || event.args.empty())
return false;
chatHandler->createChatRoom(event.args, "", 100, true);
return true;
@@ -1025,13 +1034,13 @@ impHandler(createPublicChatRoom)
impHandler(joinChatRoom)
{
- if (!chatHandler)
+ if (chatHandler == nullptr)
return false;
const std::string args = event.args;
if (args.empty())
return false;
ChatObject *const chat = ChatObject::findByName(args);
- if (!chat)
+ if (chat == nullptr)
return false;
chatHandler->joinChat(chat, "");
return true;
@@ -1039,7 +1048,7 @@ impHandler(joinChatRoom)
impHandler0(leaveChatRoom)
{
- if (chatHandler)
+ if (chatHandler != nullptr)
{
chatHandler->leaveChatRoom();
return true;
@@ -1104,7 +1113,7 @@ impHandler(slide)
int x = 0;
int y = 0;
- if (adminHandler && parse2Int(event.args, x, y))
+ if ((adminHandler != nullptr) && parse2Int(event.args, x, y))
{
adminHandler->slide(x, y);
return true;
@@ -1117,7 +1126,7 @@ impHandler(selectSkillLevel)
int skill = 0;
int level = 0;
- if (skillDialog && parse2Int(event.args, skill, level))
+ if ((skillDialog != nullptr) && parse2Int(event.args, skill, level))
{
skillDialog->selectSkillLevel(skill, level);
return true;
@@ -1127,7 +1136,7 @@ impHandler(selectSkillLevel)
impHandler(skill)
{
- if (!skillDialog)
+ if (skillDialog == nullptr)
return false;
StringVect vect;
@@ -1173,7 +1182,7 @@ impHandler(skill)
impHandler(craft)
{
const std::string args = event.args;
- if (args.empty() || !inventoryWindow)
+ if (args.empty() || (inventoryWindow == nullptr))
return false;
inventoryWindow->moveItemToCraft(atoi(args.c_str()));
@@ -1182,14 +1191,14 @@ impHandler(craft)
impHandler(npcClipboard)
{
- if (npcHandler)
+ if (npcHandler != nullptr)
{
int x = 0;
int y = 0;
NpcDialog *const dialog = npcHandler->getCurrentNpcDialog();
- if (dialog && parse2Int(event.args, x, y))
+ if ((dialog != nullptr) && parse2Int(event.args, x, y))
{
dialog->copyToClipboard(x, y);
return true;
@@ -1209,11 +1218,11 @@ impHandler(clipboardCopy)
impHandler(addPickup)
{
- if (actorManager)
+ if (actorManager != nullptr)
{
actorManager->removePickupItem(event.args);
actorManager->addPickupItem(event.args);
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updatePickupFilter();
return true;
}
@@ -1222,7 +1231,7 @@ impHandler(addPickup)
impHandler(removePickup)
{
- if (actorManager)
+ if (actorManager != nullptr)
{
if (event.args.empty())
{ // default pickup manipulation
@@ -1241,7 +1250,7 @@ impHandler(removePickup)
{ // any other pickups
actorManager->removePickupItem(event.args);
}
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updatePickupFilter();
return true;
}
@@ -1250,11 +1259,11 @@ impHandler(removePickup)
impHandler(ignorePickup)
{
- if (actorManager)
+ if (actorManager != nullptr)
{
actorManager->removePickupItem(event.args);
actorManager->addIgnorePickupItem(event.args);
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updatePickupFilter();
return true;
}
@@ -1614,7 +1623,7 @@ impHandler(commandGuildRecall)
impHandler(mailTo)
{
- if (!mailWindow)
+ if (mailWindow == nullptr)
return false;
mailWindow->createMail(event.args);
return true;
@@ -1625,7 +1634,7 @@ impHandler(adoptChild)
const std::string nick = getNick(event);
Being *const being = actorManager->findBeingByName(
nick, ActorType::Player);
- if (!being)
+ if (being == nullptr)
return true;
familyHandler->askForChild(being);
return true;
@@ -1638,7 +1647,7 @@ impHandler(showSkillLevels)
return false;
const SkillInfo *restrict const skill = skillDialog->getSkill(
atoi(args.c_str()));
- if (!skill)
+ if (skill == nullptr)
return false;
popupMenu->showSkillLevelPopup(skill);
return true;
@@ -1651,7 +1660,7 @@ impHandler(showSkillType)
return false;
const SkillInfo *restrict const skill = skillDialog->getSkill(
atoi(args.c_str()));
- if (!skill)
+ if (skill == nullptr)
return false;
popupMenu->showSkillTypePopup(skill);
return true;
@@ -1662,7 +1671,7 @@ impHandler(selectSkillType)
int skill = 0;
int type = 0;
- if (skillDialog && parse2Int(event.args, skill, type))
+ if ((skillDialog != nullptr) && parse2Int(event.args, skill, type))
{
skillDialog->selectSkillCastType(skill,
static_cast<CastTypeT>(type));
@@ -1678,7 +1687,7 @@ impHandler(showSkillOffsetX)
return false;
const SkillInfo *restrict const skill = skillDialog->getSkill(
atoi(args.c_str()));
- if (!skill)
+ if (skill == nullptr)
return false;
popupMenu->showSkillOffsetPopup(skill, true);
return true;
@@ -1691,7 +1700,7 @@ impHandler(showSkillOffsetY)
return false;
const SkillInfo *restrict const skill = skillDialog->getSkill(
atoi(args.c_str()));
- if (!skill)
+ if (skill == nullptr)
return false;
popupMenu->showSkillOffsetPopup(skill, false);
return true;
@@ -1702,7 +1711,7 @@ impHandler(setSkillOffsetX)
int skill = 0;
int offset = 0;
- if (skillDialog && parse2Int(event.args, skill, offset))
+ if ((skillDialog != nullptr) && parse2Int(event.args, skill, offset))
{
skillDialog->setSkillOffsetX(skill, offset);
return true;
@@ -1715,7 +1724,7 @@ impHandler(setSkillOffsetY)
int skill = 0;
int offset = 0;
- if (skillDialog && parse2Int(event.args, skill, offset))
+ if ((skillDialog != nullptr) && parse2Int(event.args, skill, offset))
{
skillDialog->setSkillOffsetY(skill, offset);
return true;
@@ -1725,7 +1734,7 @@ impHandler(setSkillOffsetY)
impHandler(partyItemShare)
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return false;
if (localPlayer->isInParty() == false)
@@ -1791,7 +1800,7 @@ impHandler(partyItemShare)
impHandler(partyExpShare)
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return false;
if (localPlayer->isInParty() == false)
@@ -1857,7 +1866,7 @@ impHandler(partyExpShare)
impHandler(partyAutoItemShare)
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return false;
if (localPlayer->isInParty() == false)
@@ -1923,7 +1932,7 @@ impHandler(partyAutoItemShare)
impHandler0(outfitToChat)
{
- if (!outfitWindow || !chatWindow)
+ if ((outfitWindow == nullptr) || (chatWindow == nullptr))
return false;
const std::string str = outfitWindow->getOutfitString();
@@ -1934,7 +1943,7 @@ impHandler0(outfitToChat)
impHandler0(outfitClear)
{
- if (!outfitWindow)
+ if (outfitWindow == nullptr)
return false;
outfitWindow->clearCurrentOutfit();
@@ -1943,7 +1952,7 @@ impHandler0(outfitClear)
impHandler(moveAttackUp)
{
- if (!actorManager)
+ if (actorManager == nullptr)
return false;
const std::string args = event.args;
const int idx = actorManager->getAttackMobIndex(args);
@@ -1967,7 +1976,7 @@ impHandler(moveAttackUp)
++ it2;
}
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updateAttackFilter();
return true;
}
@@ -1976,7 +1985,7 @@ impHandler(moveAttackUp)
impHandler(moveAttackDown)
{
- if (!actorManager)
+ if (actorManager == nullptr)
return false;
const std::string args = event.args;
const int idx = actorManager->getAttackMobIndex(args);
@@ -2004,7 +2013,7 @@ impHandler(moveAttackDown)
++ it2;
}
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updateAttackFilter();
return true;
}
@@ -2013,7 +2022,7 @@ impHandler(moveAttackDown)
impHandler(movePriorityAttackUp)
{
- if (!actorManager)
+ if (actorManager == nullptr)
return false;
const std::string args = event.args;
const int idx = actorManager->
@@ -2038,7 +2047,7 @@ impHandler(movePriorityAttackUp)
++ it2;
}
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updateAttackFilter();
return true;
}
@@ -2047,7 +2056,7 @@ impHandler(movePriorityAttackUp)
impHandler(movePriorityAttackDown)
{
- if (!actorManager)
+ if (actorManager == nullptr)
return false;
const std::string args = event.args;
const int idx = actorManager
@@ -2076,7 +2085,7 @@ impHandler(movePriorityAttackDown)
++ it2;
}
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updateAttackFilter();
return true;
}
diff --git a/src/actions/move.cpp b/src/actions/move.cpp
index aa0c0d068..d2be4de7e 100644
--- a/src/actions/move.cpp
+++ b/src/actions/move.cpp
@@ -48,9 +48,9 @@ namespace Actions
static bool closeMoveNpcDialog(bool focus)
{
NpcDialog *const dialog = NpcDialog::getActive();
- if (dialog)
+ if (dialog != nullptr)
{
- if (dialog->isCloseState())
+ if (dialog->isCloseState() != 0)
{
dialog->closeDialog();
return true;
@@ -101,10 +101,11 @@ impHandler(moveDown)
impHandler(moveLeft)
{
- if (outfitWindow && inputManager.isActionActive(InputAction::WEAR_OUTFIT))
+ if (outfitWindow != nullptr &&
+ inputManager.isActionActive(InputAction::WEAR_OUTFIT))
{
outfitWindow->wearPreviousOutfit();
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -121,10 +122,11 @@ impHandler(moveLeft)
impHandler(moveRight)
{
- if (outfitWindow && inputManager.isActionActive(InputAction::WEAR_OUTFIT))
+ if (outfitWindow != nullptr &&
+ inputManager.isActionActive(InputAction::WEAR_OUTFIT))
{
outfitWindow->wearNextOutfit();
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -149,7 +151,7 @@ impHandler(moveForward)
impHandler(moveToPoint)
{
const int num = event.action - InputAction::MOVE_TO_POINT_1;
- if (socialWindow && num >= 0)
+ if ((socialWindow != nullptr) && num >= 0)
{
socialWindow->selectPortal(num);
return true;
@@ -160,7 +162,7 @@ impHandler(moveToPoint)
impHandler0(crazyMoves)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
::crazyMoves->crazyMove();
return true;
@@ -170,8 +172,9 @@ impHandler0(crazyMoves)
impHandler0(moveToTarget)
{
- if (localPlayer && !inputManager.isActionActive(InputAction::TARGET_ATTACK)
- && !inputManager.isActionActive(InputAction::ATTACK))
+ if (localPlayer != nullptr &&
+ !inputManager.isActionActive(InputAction::TARGET_ATTACK) &&
+ !inputManager.isActionActive(InputAction::ATTACK))
{
localPlayer->moveToTarget();
return true;
@@ -181,11 +184,12 @@ impHandler0(moveToTarget)
impHandler0(moveToHome)
{
- if (localPlayer && !inputManager.isActionActive(InputAction::TARGET_ATTACK)
- && !inputManager.isActionActive(InputAction::ATTACK))
+ if (localPlayer != nullptr &&
+ !inputManager.isActionActive(InputAction::TARGET_ATTACK) &&
+ !inputManager.isActionActive(InputAction::ATTACK))
{
localPlayer->moveToHome();
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -194,14 +198,14 @@ impHandler0(moveToHome)
impHandler0(directUp)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
if (localPlayer->getDirection() != BeingDirection::UP)
{
// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION))
{
localPlayer->setDirection(BeingDirection::UP);
- if (playerHandler)
+ if (playerHandler != nullptr)
playerHandler->setDirection(BeingDirection::UP);
}
}
@@ -212,14 +216,14 @@ impHandler0(directUp)
impHandler0(directDown)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
if (localPlayer->getDirection() != BeingDirection::DOWN)
{
// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION))
{
localPlayer->setDirection(BeingDirection::DOWN);
- if (playerHandler)
+ if (playerHandler != nullptr)
{
playerHandler->setDirection(
BeingDirection::DOWN);
@@ -233,14 +237,14 @@ impHandler0(directDown)
impHandler0(directLeft)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
if (localPlayer->getDirection() != BeingDirection::LEFT)
{
// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION))
{
localPlayer->setDirection(BeingDirection::LEFT);
- if (playerHandler)
+ if (playerHandler != nullptr)
{
playerHandler->setDirection(
BeingDirection::LEFT);
@@ -254,14 +258,14 @@ impHandler0(directLeft)
impHandler0(directRight)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
if (localPlayer->getDirection() != BeingDirection::RIGHT)
{
// if (PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION))
{
localPlayer->setDirection(BeingDirection::RIGHT);
- if (playerHandler)
+ if (playerHandler != nullptr)
{
playerHandler->setDirection(
BeingDirection::RIGHT);
diff --git a/src/actions/pets.cpp b/src/actions/pets.cpp
index cfe0e39e5..79e004f15 100644
--- a/src/actions/pets.cpp
+++ b/src/actions/pets.cpp
@@ -83,7 +83,7 @@ impHandler(setPetName)
if (args.empty())
{
const Being *const pet = getPet();
- if (!pet)
+ if (pet == nullptr)
return false;
// TRANSLATORS: dialog header
inputActionReplayListener.openDialog(_("Rename your pet"),
@@ -105,9 +105,9 @@ impHandler(petEmote)
&& event.action <= InputAction::PET_EMOTE_48)
{
const int emotion = event.action - InputAction::PET_EMOTE_1;
- if (emoteShortcut)
+ if (emoteShortcut != nullptr)
petHandler->emote(emoteShortcut->getEmote(emotion));
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -117,7 +117,7 @@ impHandler(petEmote)
impHandler(catchPet)
{
- if (!localPlayer || !actorManager)
+ if ((localPlayer == nullptr) || (actorManager == nullptr))
return false;
Being *target = nullptr;
@@ -135,11 +135,11 @@ impHandler(catchPet)
}
}
- if (!target)
+ if (target == nullptr)
target = localPlayer->getTarget();
else
localPlayer->setTarget(target);
- if (target)
+ if (target != nullptr)
petHandler->catchPet(target);
return true;
}
@@ -147,7 +147,7 @@ impHandler(catchPet)
impHandler0(petMoveUp)
{
const Being *const pet = getPet();
- if (!pet)
+ if (pet == nullptr)
return false;
petHandler->move(pet->getTileX(), pet->getTileY() - 1);
return true;
@@ -156,7 +156,7 @@ impHandler0(petMoveUp)
impHandler0(petMoveDown)
{
const Being *const pet = getPet();
- if (!pet)
+ if (pet == nullptr)
return false;
petHandler->move(pet->getTileX(), pet->getTileY() + 1);
return true;
@@ -165,7 +165,7 @@ impHandler0(petMoveDown)
impHandler0(petMoveLeft)
{
const Being *const pet = getPet();
- if (!pet)
+ if (pet == nullptr)
return false;
petHandler->move(pet->getTileX() - 1, pet->getTileY());
return true;
@@ -174,7 +174,7 @@ impHandler0(petMoveLeft)
impHandler0(petMoveRight)
{
const Being *const pet = getPet();
- if (!pet)
+ if (pet == nullptr)
return false;
petHandler->move(pet->getTileX() + 1, pet->getTileY());
return true;
diff --git a/src/actions/statusbar.cpp b/src/actions/statusbar.cpp
index 4117c5daa..5832d49c0 100644
--- a/src/actions/statusbar.cpp
+++ b/src/actions/statusbar.cpp
@@ -112,7 +112,7 @@ impHandler0(changeMoveToTarget)
impHandler0(changeGameModifier)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
{
GameModifiers::changeGameModifiers(false);
return true;
@@ -123,7 +123,7 @@ impHandler0(changeGameModifier)
impHandler0(changeAudio)
{
soundManager.changeAudio();
- if (localPlayer)
+ if (localPlayer != nullptr)
localPlayer->updateMusic();
return true;
}
@@ -131,10 +131,10 @@ impHandler0(changeAudio)
impHandler0(away)
{
GameModifiers::changeAwayMode(true);
- if (localPlayer)
+ if (localPlayer != nullptr)
{
localPlayer->updateStatus();
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -143,10 +143,10 @@ impHandler0(away)
impHandler0(camera)
{
- if (viewport)
+ if (viewport != nullptr)
{
viewport->toggleCameraMode();
- if (Game::instance())
+ if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
}
@@ -155,10 +155,10 @@ impHandler0(camera)
impHandler0(changeMapMode)
{
- if (viewport)
+ if (viewport != nullptr)
viewport->toggleMapDrawType();
UpdateStatusListener::distributeEvent();
- if (Game::instance())
+ if (Game::instance() != nullptr)
{
if (Map *const map = Game::instance()->getCurrentMap())
map->redrawMap();
@@ -169,9 +169,9 @@ impHandler0(changeMapMode)
impHandler0(changeTrade)
{
unsigned int deflt = player_relations.getDefault();
- if (deflt & PlayerRelation::TRADE)
+ if ((deflt & PlayerRelation::TRADE) != 0u)
{
- if (localChatTab)
+ if (localChatTab != nullptr)
{
// TRANSLATORS: disable trades message
localChatTab->chatLog(_("Ignoring incoming trade requests"),
@@ -181,7 +181,7 @@ impHandler0(changeTrade)
}
else
{
- if (localChatTab)
+ if (localChatTab != nullptr)
{
// TRANSLATORS: enable trades message
localChatTab->chatLog(_("Accepting incoming trade requests"),
diff --git a/src/actions/tabs.cpp b/src/actions/tabs.cpp
index 98ce344ea..dc88595eb 100644
--- a/src/actions/tabs.cpp
+++ b/src/actions/tabs.cpp
@@ -35,7 +35,7 @@ namespace Actions
impHandler0(prevSocialTab)
{
- if (socialWindow)
+ if (socialWindow != nullptr)
{
socialWindow->prevTab();
return true;
@@ -45,7 +45,7 @@ impHandler0(prevSocialTab)
impHandler0(nextSocialTab)
{
- if (socialWindow)
+ if (socialWindow != nullptr)
{
socialWindow->nextTab();
return true;
@@ -55,7 +55,7 @@ impHandler0(nextSocialTab)
impHandler0(nextShortcutsTab)
{
- if (itemShortcutWindow)
+ if (itemShortcutWindow != nullptr)
{
itemShortcutWindow->nextTab();
return true;
@@ -65,7 +65,7 @@ impHandler0(nextShortcutsTab)
impHandler0(prevShortcutsTab)
{
- if (itemShortcutWindow)
+ if (itemShortcutWindow != nullptr)
{
itemShortcutWindow->prevTab();
return true;
@@ -75,7 +75,7 @@ impHandler0(prevShortcutsTab)
impHandler0(nextCommandsTab)
{
- if (spellShortcutWindow)
+ if (spellShortcutWindow != nullptr)
{
spellShortcutWindow->nextTab();
return true;
@@ -85,7 +85,7 @@ impHandler0(nextCommandsTab)
impHandler0(prevCommandsTab)
{
- if (spellShortcutWindow)
+ if (spellShortcutWindow != nullptr)
{
spellShortcutWindow->prevTab();
return true;
diff --git a/src/actions/target.cpp b/src/actions/target.cpp
index 915bf18d4..a72cbe502 100644
--- a/src/actions/target.cpp
+++ b/src/actions/target.cpp
@@ -33,7 +33,7 @@ namespace Actions
static bool setTarget(const ActorTypeT type, const AllowSort allowSort)
{
- if (localPlayer)
+ if (localPlayer != nullptr)
return localPlayer->setNewTarget(type, allowSort) != nullptr;
return false;
}
@@ -75,10 +75,10 @@ impHandler0(targetPet)
impHandler0(contextMenu)
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return false;
const Being *const target = localPlayer->getTarget();
- if (!target)
+ if (target == nullptr)
return true;
popupMenu->showPopup(target->getPixelX(),
diff --git a/src/actions/windows.cpp b/src/actions/windows.cpp
index bb7de28df..3e429faea 100644
--- a/src/actions/windows.cpp
+++ b/src/actions/windows.cpp
@@ -64,7 +64,7 @@ namespace Actions
impHandler0(setupWindowShow)
{
- if (setupWindow)
+ if (setupWindow != nullptr)
{
if (setupWindow->isWindowVisible())
{
@@ -82,14 +82,14 @@ impHandler0(setupWindowShow)
impHandler0(hideWindows)
{
- if (setupWindow)
+ if (setupWindow != nullptr)
setupWindow->hideWindows();
return true;
}
static bool showHelpPage(const std::string &page, const bool showHide)
{
- if (helpWindow)
+ if (helpWindow != nullptr)
{
if (showHide && helpWindow->isWindowVisible())
{
@@ -107,9 +107,9 @@ static bool showHelpPage(const std::string &page, const bool showHide)
impHandler(helpWindowShow)
{
- if (!chatWindow || !chatWindow->isInputFocused())
+ if ((chatWindow == nullptr) || !chatWindow->isInputFocused())
return showHelpPage("index", true);
- if (!event.tab)
+ if (event.tab == nullptr)
return showHelpPage("chatcommands", true);
switch (event.tab->getType())
{
@@ -145,7 +145,7 @@ impHandler0(aboutWindowShow)
static void showHideWindow(Window *const window)
{
- if (window)
+ if (window != nullptr)
{
window->setVisible(fromBool(
!window->isWindowVisible(), Visible));
@@ -180,7 +180,7 @@ impHandler0(skillDialogShow)
impHandler0(minimapWindowShow)
{
- if (minimap)
+ if (minimap != nullptr)
{
minimap->toggle();
return true;
@@ -280,21 +280,21 @@ impHandler0(bankWindowShow)
impHandler0(cartWindowShow)
{
if (Net::getNetworkType() == ServerType::TMWATHENA ||
- !localPlayer ||
+ (localPlayer == nullptr) ||
!localPlayer->getHaveCart())
{
return false;
}
showHideWindow(cartWindow);
- if (inventoryWindow)
+ if (inventoryWindow != nullptr)
inventoryWindow->updateDropButton();
return true;
}
impHandler0(updaterWindowShow)
{
- if (updaterWindow)
+ if (updaterWindow != nullptr)
updaterWindow->deleteSelf();
else
DialogsManager::createUpdaterWindow();
@@ -303,7 +303,7 @@ impHandler0(updaterWindowShow)
impHandler0(quickWindowShow)
{
- if (setupWindow)
+ if (setupWindow != nullptr)
{
if (setupWindow->isWindowVisible())
setupWindow->doCancel();
@@ -333,23 +333,26 @@ impHandler(showItems)
{
being = actorManager->findBeing(fromInt(atoi(
args.substr(1).c_str()), BeingId));
- if (being && being->getType() == ActorType::Monster)
+ if ((being != nullptr) && being->getType() == ActorType::Monster)
being = nullptr;
}
else
{
being = actorManager->findBeingByName(args, ActorType::Player);
}
- if (!being)
+ if (being == nullptr)
return true;
if (being == localPlayer)
{
- if (equipmentWindow && !equipmentWindow->isWindowVisible())
+ if (equipmentWindow != nullptr &&
+ !equipmentWindow->isWindowVisible())
+ {
equipmentWindow->setVisible(Visible_true);
+ }
}
else
{
- if (beingEquipmentWindow)
+ if (beingEquipmentWindow != nullptr)
{
beingEquipmentWindow->setBeing(being);
beingEquipmentWindow->setVisible(Visible_true);