summaryrefslogtreecommitdiff
path: root/src/progs
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2020-02-23 09:30:51 +0300
committerAndrei Karas <akaras@inbox.ru>2020-02-23 09:30:51 +0300
commit1e2a88e975019929c4c7e3154537865cc09550a6 (patch)
treeae8bc68ad3a3f6b61a5e2d511d7fc17daa22bd0e /src/progs
parent6941fd4eeb1dce20aba8c42fd030c2690c37b731 (diff)
downloadmanaverse-1e2a88e975019929c4c7e3154537865cc09550a6.tar.gz
manaverse-1e2a88e975019929c4c7e3154537865cc09550a6.tar.bz2
manaverse-1e2a88e975019929c4c7e3154537865cc09550a6.tar.xz
manaverse-1e2a88e975019929c4c7e3154537865cc09550a6.zip
Fix some code style issues
Diffstat (limited to 'src/progs')
-rw-r--r--src/progs/manaplus/actions/actions.cpp4
-rw-r--r--src/progs/manaplus/actions/commands.cpp4
-rw-r--r--src/progs/manaplus/actions/pets.cpp4
-rw-r--r--src/progs/manaplus/gui/viewport.cpp4
4 files changed, 11 insertions, 5 deletions
diff --git a/src/progs/manaplus/actions/actions.cpp b/src/progs/manaplus/actions/actions.cpp
index 1a351d268..4606137f3 100644
--- a/src/progs/manaplus/actions/actions.cpp
+++ b/src/progs/manaplus/actions/actions.cpp
@@ -1274,9 +1274,11 @@ impHandler(undress)
if (sz == 2)
{
- const int itemId = atoi(pars[1].c_str());
if (target != nullptr)
+ {
+ const int itemId = atoi(pars[1].c_str());
target->undressItemById(itemId);
+ }
}
else
{
diff --git a/src/progs/manaplus/actions/commands.cpp b/src/progs/manaplus/actions/commands.cpp
index dd58c221b..711816eac 100644
--- a/src/progs/manaplus/actions/commands.cpp
+++ b/src/progs/manaplus/actions/commands.cpp
@@ -1036,9 +1036,11 @@ impHandler(homunEmote)
event.action >= InputAction::HOMUN_EMOTE_1 &&
event.action <= InputAction::HOMUN_EMOTE_48)
{
- const int emotion = event.action - InputAction::HOMUN_EMOTE_1;
if (emoteShortcut != nullptr)
+ {
+ const int emotion = event.action - InputAction::HOMUN_EMOTE_1;
homunculusHandler->emote(emoteShortcut->getEmote(emotion));
+ }
if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
diff --git a/src/progs/manaplus/actions/pets.cpp b/src/progs/manaplus/actions/pets.cpp
index bb8ec4591..fd8c959f8 100644
--- a/src/progs/manaplus/actions/pets.cpp
+++ b/src/progs/manaplus/actions/pets.cpp
@@ -102,9 +102,11 @@ impHandler(petEmote)
if (event.action >= InputAction::PET_EMOTE_1
&& event.action <= InputAction::PET_EMOTE_48)
{
- const int emotion = event.action - InputAction::PET_EMOTE_1;
if (emoteShortcut != nullptr)
+ {
+ const int emotion = event.action - InputAction::PET_EMOTE_1;
petHandler->emote(emoteShortcut->getEmote(emotion));
+ }
if (Game::instance() != nullptr)
Game::instance()->setValidSpeed();
return true;
diff --git a/src/progs/manaplus/gui/viewport.cpp b/src/progs/manaplus/gui/viewport.cpp
index 73a8db226..5483b3d0e 100644
--- a/src/progs/manaplus/gui/viewport.cpp
+++ b/src/progs/manaplus/gui/viewport.cpp
@@ -567,8 +567,6 @@ void Viewport::mousePressed(MouseEvent &event)
mMousePressX = event.getX();
mMousePressY = event.getY();
const MouseButtonT eventButton = event.getButton();
- const int pixelX = mMousePressX + mPixelViewX;
- const int pixelY = mMousePressY + mPixelViewY;
// Right click might open a popup
if (eventButton == MouseButton::RIGHT)
@@ -601,6 +599,8 @@ void Viewport::mousePressed(MouseEvent &event)
// Find the being nearest to the clicked position
if (actorManager != nullptr)
{
+ const int pixelX = mMousePressX + mPixelViewX;
+ const int pixelY = mMousePressY + mPixelViewY;
Being *const target = actorManager->findNearestLivingBeing(
pixelX, pixelY, 20, ActorType::Monster, nullptr);