summaryrefslogtreecommitdiff
path: root/src/gui/widgets/tabs
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-06 23:34:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-07 19:23:40 +0300
commit36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch)
tree190156cb88b13a38a6d13c69ee0742cc078065a1 /src/gui/widgets/tabs
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadplus-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/gui/widgets/tabs')
-rw-r--r--src/gui/widgets/tabs/chat/channeltab.cpp6
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp36
-rw-r--r--src/gui/widgets/tabs/chat/emulateguildtab.cpp14
-rw-r--r--src/gui/widgets/tabs/chat/guildtab.cpp12
-rw-r--r--src/gui/widgets/tabs/chat/partytab.cpp4
-rw-r--r--src/gui/widgets/tabs/chat/whispertab.cpp10
-rw-r--r--src/gui/widgets/tabs/debugwindowtabs.cpp12
-rw-r--r--src/gui/widgets/tabs/setup_audio.cpp4
-rw-r--r--src/gui/widgets/tabs/setup_chat.cpp2
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp18
-rw-r--r--src/gui/widgets/tabs/setup_input.cpp8
-rw-r--r--src/gui/widgets/tabs/setup_joystick.cpp14
-rw-r--r--src/gui/widgets/tabs/setup_mods.cpp4
-rw-r--r--src/gui/widgets/tabs/setup_players.cpp4
-rw-r--r--src/gui/widgets/tabs/setup_relations.cpp22
-rw-r--r--src/gui/widgets/tabs/setup_theme.cpp8
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp6
-rw-r--r--src/gui/widgets/tabs/setuptabscroll.cpp12
-rw-r--r--src/gui/widgets/tabs/skilltab.h6
-rw-r--r--src/gui/widgets/tabs/socialfriendsfunctor.h7
-rw-r--r--src/gui/widgets/tabs/socialfriendstab.h8
-rw-r--r--src/gui/widgets/tabs/socialguildtab.h10
-rw-r--r--src/gui/widgets/tabs/socialguildtab2.h4
-rw-r--r--src/gui/widgets/tabs/socialnavigationtab.h50
-rw-r--r--src/gui/widgets/tabs/socialpartytab.h8
-rw-r--r--src/gui/widgets/tabs/socialplayerstab.h22
-rw-r--r--src/gui/widgets/tabs/socialtab.h8
-rw-r--r--src/gui/widgets/tabs/tab.cpp44
28 files changed, 186 insertions, 177 deletions
diff --git a/src/gui/widgets/tabs/chat/channeltab.cpp b/src/gui/widgets/tabs/chat/channeltab.cpp
index d67de5287..37e6237a0 100644
--- a/src/gui/widgets/tabs/chat/channeltab.cpp
+++ b/src/gui/widgets/tabs/chat/channeltab.cpp
@@ -39,7 +39,7 @@ ChannelTab::ChannelTab(const Widget2 *const widget,
ChannelTab::~ChannelTab()
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->removeChannel(mChannelName);
}
@@ -55,11 +55,11 @@ bool ChannelTab::handleCommand(const std::string &restrict type,
{
if (type == "close")
{
- if (windowContainer)
+ if (windowContainer != nullptr)
windowContainer->scheduleDelete(this);
else
delete this;
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->defaultTab();
}
else
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index e59d11eb4..fc2f09350 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -84,7 +84,7 @@ ChatTab::ChatTab(const Widget2 *const widget,
mTextOutput->setOpaque(Opaque_false);
mTextOutput->setMaxRow(config.getIntValue("ChatLogLength"));
- if (chatWindow)
+ if (chatWindow != nullptr)
mTextOutput->setLinkHandler(chatWindow->mItemLinkHandler);
mTextOutput->setAlwaysUpdate(false);
@@ -92,13 +92,13 @@ ChatTab::ChatTab(const Widget2 *const widget,
ScrollArea::SHOW_ALWAYS);
mScrollArea->setScrollAmount(0, 1);
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->addTab(this);
}
ChatTab::~ChatTab()
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->removeTab(this);
delete2(mTextOutput);
@@ -225,7 +225,7 @@ void ChatTab::chatLog(std::string line,
// if configured, move magic messages log to debug chat tab
if (Net::getNetworkType() == ServerType::TMWATHENA
- && localChatTab && this == localChatTab
+ && (localChatTab != nullptr) && this == localChatTab
&& ((config.getBoolValue("showMagicInDebug")
&& own == ChatMsgType::BY_PLAYER
&& tmp.text.length() > 1
@@ -235,7 +235,7 @@ void ChatTab::chatLog(std::string line,
&& (own == ChatMsgType::BY_SERVER
|| tmp.nick.empty()))))
{
- if (debugChatTab)
+ if (debugChatTab != nullptr)
debugChatTab->chatLog(line, own, ignoreRecord, tryRemoveColors);
return;
}
@@ -247,7 +247,7 @@ void ChatTab::chatLog(std::string line,
if (config.getBoolValue("useLocalTime"))
{
const tm *const timeInfo = localtime(&t);
- if (timeInfo)
+ if (timeInfo != nullptr)
{
line = strprintf("%s[%02d:%02d] %s%s", lineColor.c_str(),
timeInfo->tm_hour, timeInfo->tm_min, tmp.nick.c_str(),
@@ -292,7 +292,7 @@ void ChatTab::chatLog(std::string line,
addRow(line);
}
- if (chatWindow && this == localChatTab)
+ if ((chatWindow != nullptr) && this == localChatTab)
chatWindow->addToAwayLog(line);
mScrollArea->logic();
@@ -307,7 +307,7 @@ void ChatTab::chatLog(std::string line,
}
const TabbedArea *const tabArea = getTabbedArea();
- if (!tabArea)
+ if (tabArea == nullptr)
return;
const bool notFocused = WindowManager::getIsMinimized() ||
@@ -317,7 +317,8 @@ void ChatTab::chatLog(std::string line,
{
if (getFlash() == 0)
{
- if (chatWindow && chatWindow->findHighlight(tmp.text))
+ if (chatWindow != nullptr &&
+ chatWindow->findHighlight(tmp.text))
{
setFlash(2);
soundManager.playGuiSound(SOUND_HIGHLIGHT);
@@ -329,8 +330,11 @@ void ChatTab::chatLog(std::string line,
}
else if (getFlash() == 2)
{
- if (chatWindow && chatWindow->findHighlight(tmp.text))
+ if (chatWindow != nullptr &&
+ chatWindow->findHighlight(tmp.text))
+ {
soundManager.playGuiSound(SOUND_HIGHLIGHT);
+ }
}
}
@@ -341,13 +345,13 @@ void ChatTab::chatLog(std::string line,
{
if (own == ChatMsgType::BY_GM)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->unHideWindow();
soundManager.playGuiSound(SOUND_GLOBAL);
}
else if (own != ChatMsgType::BY_SERVER)
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->unHideWindow();
playNewMessageSound();
}
@@ -358,7 +362,7 @@ void ChatTab::chatLog(std::string line,
void ChatTab::chatLog(const std::string &nick, std::string msg)
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return;
const ChatMsgTypeT byWho = (nick == localPlayer->getName()
@@ -441,7 +445,7 @@ void ChatTab::handleCommandStr(const std::string &msg)
void ChatTab::handleHelp(const std::string &msg)
{
- if (helpWindow)
+ if (helpWindow != nullptr)
{
helpWindow->search(msg);
helpWindow->requestMoveToTop();
@@ -457,7 +461,7 @@ bool ChatTab::handleCommands(const std::string &type, const std::string &args)
void ChatTab::saveToLogFile(const std::string &msg) const
{
- if (chatLogger)
+ if (chatLogger != nullptr)
{
if (getType() == ChatTabType::INPUT)
{
@@ -498,7 +502,7 @@ void ChatTab::addRow(std::string &line)
void ChatTab::loadFromLogFile(const std::string &name)
{
- if (chatLogger)
+ if (chatLogger != nullptr)
{
std::list<std::string> list;
chatLogger->loadLast(name, list, 5);
diff --git a/src/gui/widgets/tabs/chat/emulateguildtab.cpp b/src/gui/widgets/tabs/chat/emulateguildtab.cpp
index 4c4401242..4374f6b2c 100644
--- a/src/gui/widgets/tabs/chat/emulateguildtab.cpp
+++ b/src/gui/widgets/tabs/chat/emulateguildtab.cpp
@@ -56,13 +56,15 @@ EmulateGuildTab::~EmulateGuildTab()
bool EmulateGuildTab::handleCommand(const std::string &restrict type,
const std::string &restrict args)
{
- if (type == "invite" && guildManager)
+ if (guildManager == nullptr)
+ return false;
+ if (type == "invite")
guildManager->invite(args);
- else if (type == "leave" && guildManager)
+ else if (type == "leave")
guildManager->leave();
- else if (type == "kick" && guildManager)
+ else if (type == "kick")
guildManager->kick(args);
- else if (type == "notice" && guildManager)
+ else if (type == "notice")
guildManager->notice(args);
else
return false;
@@ -72,14 +74,14 @@ bool EmulateGuildTab::handleCommand(const std::string &restrict type,
void EmulateGuildTab::handleInput(const std::string &msg)
{
- if (!guildManager)
+ if (guildManager == nullptr)
return;
guildManager->chat(ChatWindow::doReplace(msg));
}
void EmulateGuildTab::getAutoCompleteList(StringVect &names) const
{
- if (!guildManager)
+ if (guildManager == nullptr)
return;
guildManager->getNames(names);
diff --git a/src/gui/widgets/tabs/chat/guildtab.cpp b/src/gui/widgets/tabs/chat/guildtab.cpp
index 982c27da5..51416b8ef 100644
--- a/src/gui/widgets/tabs/chat/guildtab.cpp
+++ b/src/gui/widgets/tabs/chat/guildtab.cpp
@@ -60,23 +60,23 @@ GuildTab::~GuildTab()
bool GuildTab::handleCommand(const std::string &restrict type,
const std::string &restrict args)
{
- if (type == "invite" && EAthena::taGuild)
+ if (type == "invite" && (EAthena::taGuild != nullptr))
{
guildHandler->invite(args);
}
- else if (type == "leave" && EAthena::taGuild)
+ else if (type == "leave" && (EAthena::taGuild != nullptr))
{
inputManager.executeChatCommand(InputAction::LEAVE_GUILD,
std::string(),
this);
}
- else if (type == "kick" && EAthena::taGuild)
+ else if (type == "kick" && (EAthena::taGuild != nullptr))
{
inputManager.executeChatCommand(InputAction::KICK_GUILD,
args,
this);
}
- else if (type == "notice" && EAthena::taGuild)
+ else if (type == "notice" && (EAthena::taGuild != nullptr))
{
inputManager.executeChatCommand(InputAction::GUILD_NOTICE,
args,
@@ -92,7 +92,7 @@ bool GuildTab::handleCommand(const std::string &restrict type,
void GuildTab::handleInput(const std::string &msg)
{
- if (!EAthena::taGuild)
+ if (EAthena::taGuild == nullptr)
return;
guildHandler->chat(ChatWindow::doReplace(msg));
@@ -100,7 +100,7 @@ void GuildTab::handleInput(const std::string &msg)
void GuildTab::getAutoCompleteList(StringVect &names) const
{
- if (EAthena::taGuild)
+ if (EAthena::taGuild != nullptr)
EAthena::taGuild->getNames(names);
}
diff --git a/src/gui/widgets/tabs/chat/partytab.cpp b/src/gui/widgets/tabs/chat/partytab.cpp
index 366a78241..befbb0393 100644
--- a/src/gui/widgets/tabs/chat/partytab.cpp
+++ b/src/gui/widgets/tabs/chat/partytab.cpp
@@ -118,12 +118,12 @@ bool PartyTab::handleCommand(const std::string &restrict type,
void PartyTab::getAutoCompleteList(StringVect &names) const
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return;
const Party *const p = localPlayer->getParty();
- if (p)
+ if (p != nullptr)
p->getNames(names);
}
diff --git a/src/gui/widgets/tabs/chat/whispertab.cpp b/src/gui/widgets/tabs/chat/whispertab.cpp
index 1cbf471c7..d8672b22d 100644
--- a/src/gui/widgets/tabs/chat/whispertab.cpp
+++ b/src/gui/widgets/tabs/chat/whispertab.cpp
@@ -45,7 +45,7 @@ WhisperTab::WhisperTab(const Widget2 *const widget,
WhisperTab::~WhisperTab()
{
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->removeWhisper(mNick);
}
@@ -55,7 +55,7 @@ void WhisperTab::handleInput(const std::string &msg)
newMsg = ChatWindow::doReplace(msg);
chatHandler->privateMessage(mNick, newMsg);
- if (localPlayer)
+ if (localPlayer != nullptr)
chatLog(localPlayer->getName(), newMsg);
else
chatLog("?", newMsg);
@@ -78,7 +78,7 @@ void WhisperTab::handleCommandStr(const std::string &msg)
{
std::string str = textToMe(args);
chatHandler->privateMessage(mNick, str);
- if (localPlayer)
+ if (localPlayer != nullptr)
chatLog(localPlayer->getName(), str);
else
chatLog("?", str);
@@ -94,11 +94,11 @@ bool WhisperTab::handleCommand(const std::string &restrict type,
{
if (type == "close")
{
- if (windowContainer)
+ if (windowContainer != nullptr)
windowContainer->scheduleDelete(this);
else
delete this;
- if (chatWindow)
+ if (chatWindow != nullptr)
chatWindow->defaultTab();
}
else
diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp
index e75e1d42d..4a600d2fd 100644
--- a/src/gui/widgets/tabs/debugwindowtabs.cpp
+++ b/src/gui/widgets/tabs/debugwindowtabs.cpp
@@ -171,7 +171,7 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) :
void MapDebugTab::logic()
{
BLOCK_START("MapDebugTab::logic")
- if (localPlayer)
+ if (localPlayer != nullptr)
{
// TRANSLATORS: debug window label
mXYLabel->setCaption(strprintf("%s (%d, %d)", _("Player Position:"),
@@ -184,7 +184,7 @@ void MapDebugTab::logic()
}
const Map *const map = Game::instance()->getCurrentMap();
- if (map && viewport)
+ if ((map != nullptr) && (viewport != nullptr))
{
// Get the current mouse position
const int mouseTileX = (viewport->mMouseX + viewport->getCameraX())
@@ -329,7 +329,7 @@ TargetDebugTab::TargetDebugTab(const Widget2 *const widget) :
void TargetDebugTab::logic()
{
BLOCK_START("TargetDebugTab::logic")
- if (localPlayer && localPlayer->getTarget())
+ if ((localPlayer != nullptr) && (localPlayer->getTarget() != nullptr))
{
const Being *const target = localPlayer->getTarget();
@@ -344,7 +344,7 @@ void TargetDebugTab::logic()
mTargetTypeLabel->setCaption(strprintf("%s %d",
// TRANSLATORS: debug window label
_("Target type:"), toInt(target->getSubType(), int)));
- if (target->getLevel())
+ if (target->getLevel() != 0)
{
mTargetLevelLabel->setCaption(strprintf("%s %d",
// TRANSLATORS: debug window label
@@ -389,7 +389,7 @@ void TargetDebugTab::logic()
_("Effects:"), target->getStatusEffectsString().c_str()));
const int delay = target->getAttackDelay();
- if (delay)
+ if (delay != 0)
{
mAttackDelayLabel->setCaption(strprintf("%s %d",
// TRANSLATORS: debug window label
@@ -469,7 +469,7 @@ NetDebugTab::NetDebugTab(const Widget2 *const widget) :
void NetDebugTab::logic()
{
BLOCK_START("NetDebugTab::logic")
- if (localPlayer)
+ if (localPlayer != nullptr)
{
// TRANSLATORS: debug window label
mPingLabel->setCaption(strprintf(_("Ping: %s ms"),
diff --git a/src/gui/widgets/tabs/setup_audio.cpp b/src/gui/widgets/tabs/setup_audio.cpp
index 0b958951a..7a37f2d89 100644
--- a/src/gui/widgets/tabs/setup_audio.cpp
+++ b/src/gui/widgets/tabs/setup_audio.cpp
@@ -181,10 +181,10 @@ void Setup_Audio::apply()
soundManager.init();
if (config.getBoolValue("playMusic"))
{
- if (viewport)
+ if (viewport != nullptr)
{ // in game
const Map *const map = viewport->getMap();
- if (map)
+ if (map != nullptr)
{
soundManager.playMusic(map->getMusicFile(),
SkipError_false);
diff --git a/src/gui/widgets/tabs/setup_chat.cpp b/src/gui/widgets/tabs/setup_chat.cpp
index c9d0565b9..b27e1ec53 100644
--- a/src/gui/widgets/tabs/setup_chat.cpp
+++ b/src/gui/widgets/tabs/setup_chat.cpp
@@ -333,7 +333,7 @@ void Setup_Chat::apply()
{
SetupTabScroll::apply();
- if (chatWindow)
+ if (chatWindow != nullptr)
{
chatWindow->adjustTabSize();
chatWindow->parseHighlights();
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index 9f7ad0154..f4efb2832 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -201,7 +201,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) :
Setup_Colors::~Setup_Colors()
{
- if (mPreviewBox && mPreviewBox->getContent() == mPreview)
+ if ((mPreviewBox != nullptr) && mPreviewBox->getContent() == mPreview)
delete2(mTextPreview)
else
delete2(mPreview)
@@ -246,7 +246,7 @@ void Setup_Colors::action(const ActionEvent &event)
void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED)
{
- if (!userPalette)
+ if (userPalette == nullptr)
return;
mSelected = mColorBox->getSelected();
@@ -308,7 +308,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED)
break;
case UserColorId::ATTACK_RANGE_BORDER:
case UserColorId::HOME_PLACE_BORDER:
- if (gui)
+ if (gui != nullptr)
mTextPreview->setFont(gui->getFont());
mTextPreview->setTextColor(col);
mTextPreview->setOutline(false);
@@ -398,21 +398,21 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED)
void Setup_Colors::setEntry(Slider *const s, TextField *const t,
const int value)
{
- if (s)
+ if (s != nullptr)
s->setValue(value);
- if (t)
+ if (t != nullptr)
t->setText(toString(value));
}
void Setup_Colors::apply()
{
- if (userPalette)
+ if (userPalette != nullptr)
userPalette->commit();
}
void Setup_Colors::cancel()
{
- if (!userPalette)
+ if (userPalette == nullptr)
return;
userPalette->rollback();
@@ -430,7 +430,7 @@ void Setup_Colors::cancel()
void Setup_Colors::updateGradType()
{
- if (mSelected == -1 || !userPalette)
+ if (mSelected == -1 || (userPalette == nullptr))
return;
mSelected = mColorBox->getSelected();
@@ -463,7 +463,7 @@ void Setup_Colors::updateGradType()
void Setup_Colors::updateColor() const
{
- if (mSelected == -1 || !userPalette)
+ if (mSelected == -1 || (userPalette == nullptr))
return;
const UserColorIdT type = static_cast<UserColorIdT>(
diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp
index 2b7c4bedd..dc1e531f8 100644
--- a/src/gui/widgets/tabs/setup_input.cpp
+++ b/src/gui/widgets/tabs/setup_input.cpp
@@ -91,7 +91,7 @@ Setup_Input::Setup_Input(const Widget2 *const widget) :
mKeyListModel->setSize(mActionDataSize[0]);
refreshKeys();
- if (gui)
+ if (gui != nullptr)
mKeyList->setFont(gui->getHelpFont());
mKeyList->addActionListener(this);
@@ -106,7 +106,7 @@ Setup_Input::Setup_Input(const Widget2 *const widget) :
mTabs->addActionListener(this);
mTabs->setActionEventId("tabs_");
int k = 0;
- while (pages[k])
+ while (pages[k] != nullptr)
{
mTabs->addButton(gettext(pages[k]), pages[k], false);
k ++;
@@ -257,13 +257,13 @@ void Setup_Input::action(const ActionEvent &event)
{
int k = 0;
std::string str("tabs_");
- while (pages[k])
+ while (pages[k] != nullptr)
{
if (str + pages[k] == id)
break;
k ++;
}
- if (pages[k] && str + pages[k] == id)
+ if ((pages[k] != nullptr) && str + pages[k] == id)
{
mKeyListModel->setSelectedData(k);
mKeyListModel->setSize(mActionDataSize[k]);
diff --git a/src/gui/widgets/tabs/setup_joystick.cpp b/src/gui/widgets/tabs/setup_joystick.cpp
index 784197eb9..12cf331a0 100644
--- a/src/gui/widgets/tabs/setup_joystick.cpp
+++ b/src/gui/widgets/tabs/setup_joystick.cpp
@@ -73,7 +73,7 @@ Setup_Joystick::Setup_Joystick(const Widget2 *const widget) :
mNamesDropDown->setActionEventId("name");
mNamesDropDown->addActionListener(this);
- if (joystick)
+ if (joystick != nullptr)
{
mNamesDropDown->setSelected(joystick->getNumber());
}
@@ -113,12 +113,12 @@ void Setup_Joystick::action(const ActionEvent &event)
}
else if (source == mNamesDropDown)
{
- if (joystick)
+ if (joystick != nullptr)
joystick->setNumber(mNamesDropDown->getSelected());
}
else if (source == mDetectButton)
{
- if (joystick)
+ if (joystick != nullptr)
{
joystick->reload();
Joystick::getNames(mNamesModel->getNames());
@@ -127,7 +127,7 @@ void Setup_Joystick::action(const ActionEvent &event)
}
else
{
- if (!joystick)
+ if (joystick == nullptr)
return;
if (joystick->isCalibrating())
@@ -155,7 +155,7 @@ void Setup_Joystick::setTempEnabled(const bool sel)
{
Joystick::setEnabled(sel);
mCalibrateButton->setEnabled(sel);
- if (joystick)
+ if (joystick != nullptr)
{
if (sel)
joystick->open();
@@ -166,7 +166,7 @@ void Setup_Joystick::setTempEnabled(const bool sel)
void Setup_Joystick::cancel()
{
- if (joystick)
+ if (joystick != nullptr)
joystick->setEnabled(mOriginalJoystickEnabled);
if (mOriginalJoystickEnabled != mJoystickEnabled->isSelected())
@@ -177,7 +177,7 @@ void Setup_Joystick::cancel()
void Setup_Joystick::apply()
{
- if (!joystick)
+ if (joystick == nullptr)
return;
config.setValue("joystickEnabled", joystick->isEnabled());
diff --git a/src/gui/widgets/tabs/setup_mods.cpp b/src/gui/widgets/tabs/setup_mods.cpp
index 994001763..7ee8f2f34 100644
--- a/src/gui/widgets/tabs/setup_mods.cpp
+++ b/src/gui/widgets/tabs/setup_mods.cpp
@@ -82,7 +82,7 @@ void Setup_Mods::loadMods()
FOR_EACH (ModInfoCIterator, it, mods)
{
const ModInfo *const info = (*it).second;
- if (!info)
+ if (info == nullptr)
continue;
std::string name = info->getName();
@@ -108,7 +108,7 @@ void Setup_Mods::saveMods() const
FOR_EACH (std::set<SetupItem*>::const_iterator, it, modsList)
{
const SetupItem *const item = *it;
- if (!item)
+ if (item == nullptr)
continue;
const std::string val = item->getValue();
if (val == "1")
diff --git a/src/gui/widgets/tabs/setup_players.cpp b/src/gui/widgets/tabs/setup_players.cpp
index cca3acee9..4f9d8f856 100644
--- a/src/gui/widgets/tabs/setup_players.cpp
+++ b/src/gui/widgets/tabs/setup_players.cpp
@@ -186,6 +186,6 @@ void Setup_Players::externalUpdated()
void Setup_Players::apply()
{
SetupTabScroll::apply();
- settings.enableRemoteCommands = serverConfig.getValue(
- "enableRemoteCommands", 1);
+ settings.enableRemoteCommands = (serverConfig.getValue(
+ "enableRemoteCommands", 1) != 0);
}
diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp
index 0054da32b..d81bca9a9 100644
--- a/src/gui/widgets/tabs/setup_relations.cpp
+++ b/src/gui/widgets/tabs/setup_relations.cpp
@@ -70,10 +70,10 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) :
mPlayerScrollArea(new ScrollArea(this, mPlayerTable)),
// TRANSLATORS: relation dialog button
mDefaultTrading(new CheckBox(this, _("Allow trading"),
- player_relations.getDefault() & PlayerRelation::TRADE)),
+ (player_relations.getDefault() & PlayerRelation::TRADE) != 0u)),
// TRANSLATORS: relation dialog button
mDefaultWhisper(new CheckBox(this, _("Allow whispers"),
- player_relations.getDefault() & PlayerRelation::WHISPER)),
+ (player_relations.getDefault() & PlayerRelation::WHISPER) != 0u)),
// TRANSLATORS: relation dialog button
mDeleteButton(new Button(this, _("Delete"), ACTION_DELETE, this)),
mIgnoreActionChoicesModel(new IgnoreChoicesListModel),
@@ -112,7 +112,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) :
int ignore_strategy_index = 0; // safe default
- if (player_relations.getPlayerIgnoreStrategy())
+ if (player_relations.getPlayerIgnoreStrategy() != nullptr)
{
ignore_strategy_index = player_relations.getPlayerIgnoreStrategyIndex(
player_relations.getPlayerIgnoreStrategy()->mShortName);
@@ -177,10 +177,10 @@ void Setup_Relations::apply()
| (mDefaultTrading->isSelected() ? PlayerRelation::TRADE : 0)
| (mDefaultWhisper->isSelected() ? PlayerRelation::WHISPER : 0));
- if (actorManager)
+ if (actorManager != nullptr)
actorManager->updatePlayerNames();
- if (localPlayer)
+ if (localPlayer != nullptr)
localPlayer->setCheckNameSetting(true);
}
@@ -231,10 +231,10 @@ void Setup_Relations::updatedPlayer(const std::string &name A_UNUSED)
{
mPlayerTableModel->playerRelationsUpdated();
mDefaultTrading->setSelected(
- player_relations.getDefault() & PlayerRelation::TRADE);
+ (player_relations.getDefault() & PlayerRelation::TRADE) != 0u);
mDefaultWhisper->setSelected(
- player_relations.getDefault() & PlayerRelation::WHISPER);
- if (localPlayer)
+ (player_relations.getDefault() & PlayerRelation::WHISPER) != 0u);
+ if (localPlayer != nullptr)
localPlayer->updateName();
}
@@ -246,7 +246,7 @@ void Setup_Relations::updateAll()
mPlayerTableModel = model;
int ignore_strategy_index = 0; // safe default
- if (player_relations.getPlayerIgnoreStrategy())
+ if (player_relations.getPlayerIgnoreStrategy() != nullptr)
{
ignore_strategy_index = player_relations.getPlayerIgnoreStrategyIndex(
player_relations.getPlayerIgnoreStrategy()->mShortName);
@@ -260,7 +260,7 @@ void Setup_Relations::updateAll()
void Setup_Relations::externalUpdated()
{
mDefaultTrading->setSelected(
- player_relations.getDefault() & PlayerRelation::TRADE);
+ (player_relations.getDefault() & PlayerRelation::TRADE) != 0u);
mDefaultWhisper->setSelected(
- player_relations.getDefault() & PlayerRelation::WHISPER);
+ (player_relations.getDefault() & PlayerRelation::WHISPER) != 0u);
}
diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp
index c97f192a0..47cbb2b92 100644
--- a/src/gui/widgets/tabs/setup_theme.cpp
+++ b/src/gui/widgets/tabs/setup_theme.cpp
@@ -237,7 +237,7 @@ void Setup_Theme::updateInfo()
{
delete mInfo;
mInfo = Theme::loadInfo(mTheme);
- if (mInfo)
+ if (mInfo != nullptr)
{
// TRANSLATORS: theme name
mThemeInfo = std::string(_("Name: ")).append(mInfo->name)
@@ -356,7 +356,7 @@ void Setup_Theme::apply()
}
config.setValue("selectedSkin", "");
- if (config.getStringValue("theme") != mTheme && mInfo)
+ if (config.getStringValue("theme") != mTheme && (mInfo != nullptr))
{
updateField(font, mFont);
updateField(boldFont, mBoldFont);
@@ -366,13 +366,13 @@ void Setup_Theme::apply()
updateField(npcFont, mNpcFont);
updateField(japanFont, mJapanFont);
updateField(chinaFont, mChinaFont);
- if (mInfo->fontSize)
+ if (mInfo->fontSize != 0)
{
const int size = mInfo->fontSize - 9;
if (size >= 0)
mFontSizeDropDown->setSelected(size);
}
- if (mInfo->npcfontSize)
+ if (mInfo->npcfontSize != 0)
{
const int size = mInfo->npcfontSize - 9;
if (size >= 0)
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index 24fa8951f..b11b20f39 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -360,7 +360,7 @@ void Setup_Video::action(const ActionEvent &event)
if (mode == "custom")
{
- if (mDialog)
+ if (mDialog != nullptr)
{
mode = mDialog->getText();
mDialog = nullptr;
@@ -379,7 +379,7 @@ void Setup_Video::action(const ActionEvent &event)
}
const int width = atoi(mode.substr(0, mode.find('x')).c_str());
const int height = atoi(mode.substr(mode.find('x') + 1).c_str());
- if (!width || !height)
+ if ((width == 0) || (height == 0))
return;
if (width != mainGraphics->mActualWidth
@@ -491,7 +491,7 @@ void Setup_Video::action(const ActionEvent &event)
else if (id == "detect")
{
TestMain *test = graphicsManager.startDetection();
- if (test)
+ if (test != nullptr)
{
Configuration &conf = test->getConfig();
const int val = conf.getValueInt("opengl", -1);
diff --git a/src/gui/widgets/tabs/setuptabscroll.cpp b/src/gui/widgets/tabs/setuptabscroll.cpp
index 898db7b3e..0cb623687 100644
--- a/src/gui/widgets/tabs/setuptabscroll.cpp
+++ b/src/gui/widgets/tabs/setuptabscroll.cpp
@@ -72,7 +72,7 @@ void SetupTabScroll::clear()
void SetupTabScroll::addControl(SetupItem *const widget)
{
- if (!widget)
+ if (widget == nullptr)
return;
const std::string actionId = widget->getActionEventId();
if (!actionId.empty())
@@ -109,7 +109,7 @@ void SetupTabScroll::apply()
iter = mItems.begin(), iter_end = mItems.end();
iter != iter_end; ++ iter)
{
- if ((*iter).second)
+ if ((*iter).second != nullptr)
(*iter).second->apply((*iter).first);
}
}
@@ -120,7 +120,7 @@ void SetupTabScroll::cancel()
iter = mItems.begin(), iter_end = mItems.end();
iter != iter_end; ++ iter)
{
- if ((*iter).second)
+ if ((*iter).second != nullptr)
(*iter).second->cancel((*iter).first);
}
}
@@ -132,7 +132,7 @@ void SetupTabScroll::externalUpdated()
iter != iter_end; ++ iter)
{
SetupItem *const widget = (*iter).second;
- if (widget && widget->isMainConfig() == MainConfig_false)
+ if ((widget != nullptr) && widget->isMainConfig() == MainConfig_false)
widget->externalUpdated((*iter).first);
}
}
@@ -144,7 +144,7 @@ void SetupTabScroll::externalUnloaded()
iter != iter_end; ++ iter)
{
SetupItem *const widget = (*iter).second;
- if (widget && widget->isMainConfig() == MainConfig_false)
+ if ((widget != nullptr) && widget->isMainConfig() == MainConfig_false)
widget->externalUnloaded((*iter).first);
}
}
@@ -158,6 +158,6 @@ void SetupTabScroll::widgetResized(const Event &event A_UNUSED)
void SetupTabScroll::reread(const std::string &name)
{
SetupItem *const item = mItems[name + "Event"];
- if (item)
+ if (item != nullptr)
item->rereadValue();
}
diff --git a/src/gui/widgets/tabs/skilltab.h b/src/gui/widgets/tabs/skilltab.h
index 3845444d6..9086a4d0c 100644
--- a/src/gui/widgets/tabs/skilltab.h
+++ b/src/gui/widgets/tabs/skilltab.h
@@ -65,9 +65,9 @@ class SkillTab final : public Tab
SkillInfo *getSelectedInfo() const
{
- if (mListBox)
+ if (mListBox != nullptr)
return mListBox->getSelectedInfo();
- else if (mRectangleListBox)
+ else if (mRectangleListBox != nullptr)
return mRectangleListBox->getSelectedInfo();
else
return nullptr;
@@ -76,7 +76,7 @@ class SkillTab final : public Tab
protected:
void setCurrent() override
{
- if (skillDialog)
+ if (skillDialog != nullptr)
skillDialog->updateTabSelection();
}
diff --git a/src/gui/widgets/tabs/socialfriendsfunctor.h b/src/gui/widgets/tabs/socialfriendsfunctor.h
index a15f566d6..e68647a77 100644
--- a/src/gui/widgets/tabs/socialfriendsfunctor.h
+++ b/src/gui/widgets/tabs/socialfriendsfunctor.h
@@ -35,11 +35,14 @@ class SortFriendsFunctor final
bool operator() (const Avatar *const m1,
const Avatar *const m2) const
{
- if (!m1 || !m2)
+ if ((m1 == nullptr) || (m2 == nullptr))
return false;
if (m1->getOnline() != m2->getOnline())
- return m1->getOnline() > m2->getOnline();
+ {
+ return static_cast<int>(m1->getOnline()) >
+ static_cast<int>(m2->getOnline());
+ }
if (m1->getName() != m2->getName())
{
diff --git a/src/gui/widgets/tabs/socialfriendstab.h b/src/gui/widgets/tabs/socialfriendstab.h
index 616fba43d..dfae61090 100644
--- a/src/gui/widgets/tabs/socialfriendstab.h
+++ b/src/gui/widgets/tabs/socialfriendstab.h
@@ -71,7 +71,7 @@ class SocialFriendsTab final : public SocialTab
void getPlayersAvatars()
{
- if (!actorManager)
+ if (actorManager == nullptr)
return;
std::vector<Avatar*> *const avatars = mBeings->getMembers();
@@ -90,7 +90,7 @@ class SocialFriendsTab final : public SocialTab
const std::set<std::string> &players2
= whoIsOnline->getOnlineNicks();
- if (!players)
+ if (players == nullptr)
return;
int online = 0;
@@ -99,8 +99,8 @@ class SocialFriendsTab final : public SocialTab
FOR_EACHP (StringVectCIter, it, players)
{
Avatar *const ava = new Avatar(*it);
- if (actorManager->findBeingByName(*it, ActorType::Player)
- || players2.find(*it) != players2.end())
+ if (actorManager->findBeingByName(*it, ActorType::Player) !=
+ nullptr || players2.find(*it) != players2.end())
{
ava->setOnline(true);
online ++;
diff --git a/src/gui/widgets/tabs/socialguildtab.h b/src/gui/widgets/tabs/socialguildtab.h
index 53b7d46f4..775e22c6f 100644
--- a/src/gui/widgets/tabs/socialguildtab.h
+++ b/src/gui/widgets/tabs/socialguildtab.h
@@ -78,7 +78,7 @@ class SocialGuildTab final : public SocialTab,
const std::string name = mInviteDialog->getText();
guildHandler->invite(name);
- if (localChatTab)
+ if (localChatTab != nullptr)
{
localChatTab->chatLog(strprintf(
// TRANSLATORS: chat message
@@ -96,7 +96,7 @@ class SocialGuildTab final : public SocialTab,
else if (eventId == "yes")
{
guildHandler->leave(mGuild->getId());
- if (localChatTab)
+ if (localChatTab != nullptr)
{
localChatTab->chatLog(strprintf(
// TRANSLATORS: chat message
@@ -137,7 +137,7 @@ class SocialGuildTab final : public SocialTab,
void buildCounter(const int online0, const int total0) override final
{
- if (online0 || total0)
+ if ((online0 != 0) || (total0 != 0))
{
// TRANSLATORS: social window label
mCounterString = strprintf(_("Members: %u/%u"),
@@ -146,11 +146,11 @@ class SocialGuildTab final : public SocialTab,
}
else
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return;
const Guild *const guild = localPlayer->getGuild();
- if (!guild)
+ if (guild == nullptr)
return;
const Guild::MemberList *const members = guild->getMembers();
diff --git a/src/gui/widgets/tabs/socialguildtab2.h b/src/gui/widgets/tabs/socialguildtab2.h
index a21594aab..f26e99421 100644
--- a/src/gui/widgets/tabs/socialguildtab2.h
+++ b/src/gui/widgets/tabs/socialguildtab2.h
@@ -77,11 +77,11 @@ class SocialGuildTab2 final : public SocialTab,
void buildCounter(const int online0 A_UNUSED,
const int total0 A_UNUSED) override final
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return;
const Guild *const guild = localPlayer->getGuild();
- if (!guild)
+ if (guild == nullptr)
return;
const Guild::MemberList *const members = guild->getMembers();
diff --git a/src/gui/widgets/tabs/socialnavigationtab.h b/src/gui/widgets/tabs/socialnavigationtab.h
index 0f72b60f9..80b5910f3 100644
--- a/src/gui/widgets/tabs/socialnavigationtab.h
+++ b/src/gui/widgets/tabs/socialnavigationtab.h
@@ -72,11 +72,11 @@ class SocialNavigationTab final : public SocialTab
void updateList() override final
{
- if (!socialWindow || !localPlayer)
+ if ((socialWindow == nullptr) || (localPlayer == nullptr))
return;
const Map *const map = socialWindow->getMap();
- if (!map || map->empty())
+ if ((map == nullptr) || map->empty())
return;
if (socialWindow->getProcessedPortals())
@@ -105,7 +105,7 @@ class SocialNavigationTab final : public SocialTab
while (i != portals.end())
{
MapItem *portal = *i;
- if (!portal)
+ if (portal == nullptr)
continue;
const int x = portal->getX();
@@ -115,7 +115,7 @@ class SocialNavigationTab final : public SocialTab
portal->getComment().c_str(), x, y);
Avatar *const ava = new Avatar(name);
- if (localPlayer)
+ if (localPlayer != nullptr)
ava->setOnline(localPlayer->isReachable(x, y, true));
else
ava->setOnline(false);
@@ -130,21 +130,21 @@ class SocialNavigationTab final : public SocialTab
total ++;
if (config.getBoolValue("drawHotKeys")
- && idx < 80 && outfitWindow)
+ && idx < 80 && (outfitWindow != nullptr))
{
Being *const being = actorManager
->findPortalByTile(x, y);
- if (being)
+ if (being != nullptr)
{
being->setName(keyboard.getKeyShortString(
outfitWindow->keyName(idx)));
}
- if (specialLayer)
+ if (specialLayer != nullptr)
{
portal = specialLayer->getTile(
ava->getX(), ava->getY());
- if (portal)
+ if (portal != nullptr)
{
portal->setName(keyboard.getKeyShortString(
outfitWindow->keyName(idx)));
@@ -155,7 +155,7 @@ class SocialNavigationTab final : public SocialTab
++i;
idx ++;
}
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->setProcessedPortals(true);
// TRANSLATORS: social window label
@@ -167,7 +167,7 @@ class SocialNavigationTab final : public SocialTab
void selectIndex(const unsigned num) override final
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return;
std::vector<Avatar*> *const avatars = mBeings->getMembers();
@@ -175,19 +175,19 @@ class SocialNavigationTab final : public SocialTab
return;
const Avatar *const ava = avatars->at(num);
- if (ava && localPlayer)
+ if ((ava != nullptr) && (localPlayer != nullptr))
localPlayer->navigateTo(ava->getX(), ava->getY());
}
void updateNames()
{
- if (!socialWindow)
+ if (socialWindow == nullptr)
return;
std::vector<Avatar*> *const avatars = mBeings->getMembers();
const Map *const map = socialWindow->getMap();
- if (!map)
+ if (map == nullptr)
return;
std::vector<Avatar*>::const_iterator i = avatars->begin();
@@ -195,12 +195,12 @@ class SocialNavigationTab final : public SocialTab
while (i != i_end)
{
Avatar *const ava = *i;
- if (!ava)
+ if (ava == nullptr)
break;
const MapItem *const item = map->findPortalXY(
ava->getX(), ava->getY());
- if (item)
+ if (item != nullptr)
{
const std::string name = strprintf("%s [%d %d]",
item->getComment().c_str(),
@@ -215,12 +215,12 @@ class SocialNavigationTab final : public SocialTab
int getPortalIndex(const int x, const int y)
{
- if (!socialWindow)
+ if (socialWindow == nullptr)
return -1;
std::vector<Avatar*> *const avatars = mBeings->getMembers();
const Map *const map = socialWindow->getMap();
- if (!map)
+ if (map == nullptr)
return -1;
std::vector<Avatar*>::const_iterator i = avatars->begin();
@@ -229,7 +229,7 @@ class SocialNavigationTab final : public SocialTab
while (i != i_end)
{
const Avatar *const ava = *i;
- if (!ava)
+ if (ava == nullptr)
break;
if (ava->getX() == x && ava->getY() == y)
@@ -243,23 +243,23 @@ class SocialNavigationTab final : public SocialTab
void addPortal(const int x, const int y)
{
- if (!socialWindow || !localPlayer)
+ if ((socialWindow == nullptr) || (localPlayer == nullptr))
return;
const Map *const map = socialWindow->getMap();
- if (!map)
+ if (map == nullptr)
return;
std::vector<Avatar*> *const avatars = mBeings->getMembers();
const MapItem *const portal = map->findPortalXY(x, y);
- if (!portal)
+ if (portal == nullptr)
return;
const std::string name = strprintf("%s [%d %d]",
portal->getComment().c_str(), x, y);
Avatar *const ava = new Avatar(name);
- if (localPlayer)
+ if (localPlayer != nullptr)
ava->setOnline(localPlayer->isReachable(x, y, true));
else
ava->setOnline(false);
@@ -272,11 +272,11 @@ class SocialNavigationTab final : public SocialTab
void removePortal(const int x, const int y)
{
- if (!socialWindow || !localPlayer)
+ if ((socialWindow == nullptr) || (localPlayer == nullptr))
return;
const Map *const map = socialWindow->getMap();
- if (!map)
+ if (map == nullptr)
return;
std::vector<Avatar*> *const avatars = mBeings->getMembers();
@@ -287,7 +287,7 @@ class SocialNavigationTab final : public SocialTab
{
Avatar *ava = (*i);
- if (!ava)
+ if (ava == nullptr)
break;
if (ava->getX() == x && ava->getY() == y)
diff --git a/src/gui/widgets/tabs/socialpartytab.h b/src/gui/widgets/tabs/socialpartytab.h
index 93625f7eb..b24f8f411 100644
--- a/src/gui/widgets/tabs/socialpartytab.h
+++ b/src/gui/widgets/tabs/socialpartytab.h
@@ -80,7 +80,7 @@ class SocialPartyTab final : public SocialTab,
const std::string name = mInviteDialog->getText();
partyHandler->invite(name);
- if (localChatTab)
+ if (localChatTab != nullptr)
{
localChatTab->chatLog(strprintf(
// TRANSLATORS: chat message
@@ -97,7 +97,7 @@ class SocialPartyTab final : public SocialTab,
else if (eventId == "yes")
{
partyHandler->leave();
- if (localChatTab)
+ if (localChatTab != nullptr)
{
localChatTab->chatLog(strprintf(
// TRANSLATORS: tab in social window
@@ -139,11 +139,11 @@ class SocialPartyTab final : public SocialTab,
void buildCounter(const int online0 A_UNUSED,
const int total0 A_UNUSED) override final
{
- if (!localPlayer)
+ if (localPlayer == nullptr)
return;
const Party *const party = localPlayer->getParty();
- if (!party)
+ if (party == nullptr)
return;
const Party::MemberList *const members = party->getMembers();
diff --git a/src/gui/widgets/tabs/socialplayerstab.h b/src/gui/widgets/tabs/socialplayerstab.h
index 2a80b3005..447e0791e 100644
--- a/src/gui/widgets/tabs/socialplayerstab.h
+++ b/src/gui/widgets/tabs/socialplayerstab.h
@@ -71,18 +71,18 @@ class SocialPlayersTab final : public SocialTab
void updateAvatar(const std::string &name) override final
{
- if (!actorManager)
+ if (actorManager == nullptr)
return;
BLOCK_START("SocialPlayersTab::updateAvatar")
Avatar *const avatar = findAvatarbyName(name);
- if (!avatar)
+ if (avatar == nullptr)
return;
- if (Party::getParty(1))
+ if (Party::getParty(1) != nullptr)
{
const PartyMember *const
pm = Party::getParty(1)->getMember(name);
- if (pm && pm->getMaxHp() > 0)
+ if ((pm != nullptr) && pm->getMaxHp() > 0)
{
avatar->setMaxHp(pm->getMaxHp());
avatar->setHp(pm->getHp());
@@ -90,7 +90,7 @@ class SocialPlayersTab final : public SocialTab
}
const Being *const being = actorManager->findBeingByName(
name, ActorType::Player);
- if (being)
+ if (being != nullptr)
{
avatar->setDamageHp(being->getDamageTaken());
avatar->setLevel(being->getLevel());
@@ -103,17 +103,17 @@ class SocialPlayersTab final : public SocialTab
void resetDamage(const std::string &name) override final
{
- if (!actorManager)
+ if (actorManager == nullptr)
return;
Avatar *const avatar = findAvatarbyName(name);
- if (!avatar)
+ if (avatar == nullptr)
return;
avatar->setDamageHp(0);
Being *const being = actorManager->findBeingByName(
name, ActorType::Player);
- if (being)
+ if (being != nullptr)
being->setDamageTaken(0);
}
@@ -126,7 +126,7 @@ class SocialPlayersTab final : public SocialTab
while (i != i_end)
{
ava = (*i);
- if (ava && ava->getName() == name)
+ if ((ava != nullptr) && ava->getName() == name)
return ava;
++i;
}
@@ -139,7 +139,7 @@ class SocialPlayersTab final : public SocialTab
void getPlayersAvatars()
{
std::vector<Avatar*> *const avatars = mBeings->getMembers();
- if (actorManager)
+ if (actorManager != nullptr)
{
StringVect names;
actorManager->getPlayerNames(names, NpcNames_false);
@@ -149,7 +149,7 @@ class SocialPlayersTab final : public SocialTab
{
bool finded = false;
const Avatar *const ava = (*ai);
- if (!ava)
+ if (ava == nullptr)
break;
StringVectCIter i = names.begin();
diff --git a/src/gui/widgets/tabs/socialtab.h b/src/gui/widgets/tabs/socialtab.h
index 7458e62ee..34f864561 100644
--- a/src/gui/widgets/tabs/socialtab.h
+++ b/src/gui/widgets/tabs/socialtab.h
@@ -88,14 +88,14 @@ class SocialTab notfinal : public Tab
virtual ~SocialTab()
{
// Cleanup dialogs
- if (mInviteDialog)
+ if (mInviteDialog != nullptr)
{
mInviteDialog->close();
mInviteDialog->scheduleDelete();
mInviteDialog = nullptr;
}
- if (mConfirmDialog)
+ if (mConfirmDialog != nullptr)
{
mConfirmDialog->close();
mConfirmDialog->scheduleDelete();
@@ -122,13 +122,13 @@ class SocialTab notfinal : public Tab
void updateCounter() const
{
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updateCounter(this, mCounterString);
}
void updateMenu() const
{
- if (socialWindow)
+ if (socialWindow != nullptr)
socialWindow->updateMenu(this, mMenuAction);
}
diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp
index 95588e98d..a4a2f583b 100644
--- a/src/gui/widgets/tabs/tab.cpp
+++ b/src/gui/widgets/tabs/tab.cpp
@@ -130,11 +130,11 @@ Tab::Tab(const Widget2 *const widget) :
Tab::~Tab()
{
- if (gui)
+ if (gui != nullptr)
gui->removeDragged(this);
mInstances--;
- if (mInstances == 0 && theme)
+ if (mInstances == 0 && (theme != nullptr))
{
for (int mode = 0; mode < TAB_COUNT; mode ++)
theme->unload(tabImg[mode]);
@@ -142,7 +142,7 @@ Tab::~Tab()
delete2(mLabel);
- if (mImage)
+ if (mImage != nullptr)
{
mImage->decRef();
mImage = nullptr;
@@ -162,7 +162,7 @@ void Tab::init()
if (mInstances == 0)
{
// Load the skin
- if (theme)
+ if (theme != nullptr)
{
for (int mode = 0; mode < TAB_COUNT; mode ++)
tabImg[mode] = theme->load(data[mode], "tab.xml");
@@ -174,7 +174,7 @@ void Tab::init()
add(mLabel);
const Skin *const skin = tabImg[TAB_STANDARD];
- if (!skin)
+ if (skin == nullptr)
return;
const int padding = skin->getPadding();
@@ -194,11 +194,11 @@ void Tab::updateAlpha()
for (int t = 0; t < TAB_COUNT; t++)
{
Skin *const skin = tabImg[t];
- if (skin)
+ if (skin != nullptr)
{
const ImageRect &rect = skin->getBorder();
Image *const image = rect.grid[a];
- if (image)
+ if (image != nullptr)
image->setAlpha(mAlpha);
}
}
@@ -212,7 +212,7 @@ void Tab::draw(Graphics *const graphics)
int mode = TAB_STANDARD;
// check which type of tab to draw
- if (mTabbedArea)
+ if (mTabbedArea != nullptr)
{
int labelMode = mFlash;
@@ -223,7 +223,7 @@ void Tab::draw(Graphics *const graphics)
// if tab is selected, it doesnt need to highlight activity
mFlash = 0;
}
- else if (!labelMode)
+ else if (labelMode == 0)
{
if (mHasMouse)
{
@@ -269,7 +269,7 @@ void Tab::draw(Graphics *const graphics)
}
const Skin *const skin = tabImg[mode];
- if (!skin)
+ if (skin == nullptr)
{
BLOCK_END("Tab::draw")
return;
@@ -288,10 +288,10 @@ void Tab::draw(Graphics *const graphics)
mDimension.width, mDimension.height,
rect);
- if (mImage)
+ if (mImage != nullptr)
{
const Skin *const skin1 = tabImg[TAB_STANDARD];
- if (skin1)
+ if (skin1 != nullptr)
{
const int padding = skin1->getPadding();
graphics->calcTileCollection(mVertexes,
@@ -315,7 +315,7 @@ void Tab::safeDraw(Graphics *const graphics)
int mode = TAB_STANDARD;
// check which type of tab to draw
- if (mTabbedArea)
+ if (mTabbedArea != nullptr)
{
int labelMode = mFlash;
@@ -326,7 +326,7 @@ void Tab::safeDraw(Graphics *const graphics)
// if tab is selected, it doesnt need to highlight activity
mFlash = 0;
}
- else if (!labelMode)
+ else if (labelMode == 0)
{
if (mHasMouse)
{
@@ -370,7 +370,7 @@ void Tab::safeDraw(Graphics *const graphics)
}
const Skin *const skin = tabImg[mode];
- if (!skin)
+ if (skin == nullptr)
{
BLOCK_END("Tab::draw")
return;
@@ -381,10 +381,10 @@ void Tab::safeDraw(Graphics *const graphics)
graphics->drawImageRect(0, 0,
mDimension.width, mDimension.height,
skin->getBorder());
- if (mImage)
+ if (mImage != nullptr)
{
const Skin *const skin1 = tabImg[TAB_STANDARD];
- if (skin1)
+ if (skin1 != nullptr)
{
const int padding = skin1->getPadding();
graphics->drawImage(mImage, padding, padding);
@@ -407,7 +407,7 @@ void Tab::widgetMoved(const Event &event A_UNUSED)
void Tab::setLabelFont(Font *const font)
{
- if (!mLabel)
+ if (mLabel == nullptr)
return;
mLabel->setFont(font);
@@ -420,11 +420,11 @@ void Tab::setLabelFont(Font *const font)
void Tab::adjustSize()
{
const Skin *const skin = tabImg[TAB_STANDARD];
- if (!skin)
+ if (skin == nullptr)
return;
const int pad2 = skin->getPadding() * 2;
- if (mImage)
+ if (mImage != nullptr)
{
const SDL_Rect &rect = mImage->mBounds;
setSize(rect.w + pad2, rect.h + pad2);
@@ -435,7 +435,7 @@ void Tab::adjustSize()
mLabel->getHeight() + pad2);
}
- if (mTabbedArea)
+ if (mTabbedArea != nullptr)
mTabbedArea->adjustTabPositions();
}
@@ -458,7 +458,7 @@ void Tab::setCaption(const std::string &caption)
void Tab::setImage(Image *const image)
{
- if (mImage)
+ if (mImage != nullptr)
mImage->decRef();
mImage = image;
adjustSize();