summaryrefslogtreecommitdiff
path: root/src/net/ea/npcrecv.cpp
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/net/ea/npcrecv.cpp
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadmv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
mv-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/net/ea/npcrecv.cpp')
-rw-r--r--src/net/ea/npcrecv.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/net/ea/npcrecv.cpp b/src/net/ea/npcrecv.cpp
index 10322085a..16060d6fa 100644
--- a/src/net/ea/npcrecv.cpp
+++ b/src/net/ea/npcrecv.cpp
@@ -48,7 +48,7 @@ void NpcRecv::processNpcChoice(Net::MessageIn &msg)
npcHandler->getNpc(msg, NpcAction::Other);
mRequestLang = false;
- if (mDialog)
+ if (mDialog != nullptr)
{
mDialog->choiceRequest();
mDialog->parseListItems(msg.readString(msg.getLength() - 8,
@@ -70,7 +70,7 @@ void NpcRecv::processNpcMessage(Net::MessageIn &msg)
// ignore future legacy npc commands.
if (message.size() > 3 && message.substr(0, 3) == "###")
return;
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->addText(message);
}
@@ -79,7 +79,7 @@ void NpcRecv::processNpcClose(Net::MessageIn &msg)
// Show the close button
npcHandler->getNpc(msg, NpcAction::Close);
mRequestLang = false;
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->showCloseButton();
}
@@ -88,7 +88,7 @@ void NpcRecv::processNpcNext(Net::MessageIn &msg)
// Show the next button
npcHandler->getNpc(msg, NpcAction::Next);
mRequestLang = false;
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->showNextButton();
}
@@ -97,7 +97,7 @@ void NpcRecv::processNpcIntInput(Net::MessageIn &msg)
// Request for an integer
npcHandler->getNpc(msg, NpcAction::Other);
mRequestLang = false;
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->integerRequest(0);
}
@@ -110,7 +110,7 @@ void NpcRecv::processNpcStrInput(Net::MessageIn &msg)
mRequestLang = false;
npcHandler->stringInput(npcId, getLangSimple());
}
- else if (mDialog)
+ else if (mDialog != nullptr)
{
mDialog->textRequest("");
}
@@ -132,12 +132,12 @@ void NpcRecv::processNpcCommand(Net::MessageIn &msg)
break;
case 1:
- if (viewport)
+ if (viewport != nullptr)
viewport->moveCameraToActor(npcId);
break;
case 2:
- if (viewport)
+ if (viewport != nullptr)
{
if (id == BeingId_zero)
viewport->moveCameraToPosition(x, y);
@@ -147,29 +147,29 @@ void NpcRecv::processNpcCommand(Net::MessageIn &msg)
break;
case 3:
- if (viewport)
+ if (viewport != nullptr)
viewport->returnCamera();
break;
case 4:
- if (viewport)
+ if (viewport != nullptr)
{
viewport->moveCameraRelative(x, y);
}
break;
case 5: // close dialog
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->restoreCamera();
npcHandler->closeDialog(npcId);
break;
case 6: // show avatar
- if (mDialog)
+ if (mDialog != nullptr)
{
mDialog->showAvatar(fromInt(id, BeingTypeId));
}
break;
case 7: // set avatar direction
- if (mDialog)
+ if (mDialog != nullptr)
{
mDialog->setAvatarDirection(
Net::MessageIn::fromServerDirection(
@@ -177,37 +177,37 @@ void NpcRecv::processNpcCommand(Net::MessageIn &msg)
}
break;
case 8: // set avatar action
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->setAvatarAction(toInt(id, int));
break;
case 9: // clear npc dialog
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->clearRows();
break;
case 10: // send selected item id
{
int invSize = toInt(id, int);
- if (!invSize)
+ if (invSize == 0)
invSize = 1;
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->itemRequest(invSize);
break;
}
case 11: // send selected item index
{
int invSize = toInt(id, int);
- if (!invSize)
+ if (invSize == 0)
invSize = 1;
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->itemIndexRequest(invSize);
break;
}
case 12: // send complex items
{
int invSize = toInt(id, int);
- if (!invSize)
+ if (invSize == 0)
invSize = 1;
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->itemCraftRequest(invSize);
break;
}
@@ -217,7 +217,7 @@ void NpcRecv::processNpcCommand(Net::MessageIn &msg)
if (it != NpcDialog::mNpcDialogs.end())
{
NpcDialog *const dialog = (*it).second;
- if (dialog)
+ if (dialog != nullptr)
dialog->close();
if (dialog == Ea::NpcRecv::mDialog)
Ea::NpcRecv::mDialog = nullptr;
@@ -237,7 +237,7 @@ void NpcRecv::processChangeTitle(Net::MessageIn &msg)
npcHandler->getNpc(msg, NpcAction::Other);
mRequestLang = false;
const std::string str = msg.readString(-1, "title");
- if (mDialog)
+ if (mDialog != nullptr)
mDialog->setCaption(str);
}