summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-06-08 15:09:19 +0300
committerAndrei Karas <akaras@inbox.ru>2016-06-08 15:09:19 +0300
commit83b27b146211fe301f751a6aed27e22271190795 (patch)
tree0da6e720a250661030a0221ef444c8884a1dbe13 /src
parentc9a31afec60a5085e0a3dbd26c15db397730a768 (diff)
downloadmanaplus-83b27b146211fe301f751a6aed27e22271190795.tar.gz
manaplus-83b27b146211fe301f751a6aed27e22271190795.tar.bz2
manaplus-83b27b146211fe301f751a6aed27e22271190795.tar.xz
manaplus-83b27b146211fe301f751a6aed27e22271190795.zip
Add strong typed bool IsTempSprite.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/being/being.cpp28
-rw-r--r--src/being/being.h7
-rw-r--r--src/enums/simpletypes/istempsprite.h33
-rw-r--r--src/net/ea/beingrecv.cpp2
-rw-r--r--src/net/ea/beingrecv.h6
7 files changed, 61 insertions, 17 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 54f6c9dfb..b1070b034 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1227,6 +1227,7 @@ SET(SRCS
enums/simpletypes/ignorerecord.h
enums/simpletypes/intdefines.h
enums/simpletypes/issell.h
+ enums/simpletypes/istempsprite.h
enums/simpletypes/isweapon.h
enums/simpletypes/itemcolor.h
enums/simpletypes/keep.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 3018e0668..3943b3a24 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -684,6 +684,7 @@ SRC += events/actionevent.h \
enums/simpletypes/ignorerecord.h \
enums/simpletypes/intdefines.h \
enums/simpletypes/issell.h \
+ enums/simpletypes/istempsprite.h \
enums/simpletypes/isweapon.h \
enums/simpletypes/itemcolor.h \
enums/simpletypes/keep.h \
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 1a6e14fc4..3e57c969c 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -503,7 +503,8 @@ void Being::setSubtype(const BeingTypeId subtype,
if (charServerHandler)
{
setSprite(charServerHandler->baseSprite(),
- id, info.getColor(fromInt(mLook, ItemColor)));
+ id,
+ info.getColor(fromInt(mLook, ItemColor)));
}
}
}
@@ -2469,7 +2470,7 @@ void Being::updateSprite(const unsigned int slot,
const std::string &restrict color,
const ItemColor colorId,
const IsWeapon isWeapon,
- const bool isTempSprite) restrict2
+ const IsTempSprite isTempSprite) restrict2
{
if (!charServerHandler || slot >= charServerHandler->maxSprite())
return;
@@ -2487,7 +2488,7 @@ void Being::setSprite(const unsigned int slot,
std::string color,
const ItemColor colorId,
const IsWeapon isWeapon,
- const bool isTempSprite) restrict2
+ const IsTempSprite isTempSprite) restrict2
{
if (!charServerHandler || slot >= charServerHandler->maxSprite())
return;
@@ -2520,7 +2521,9 @@ void Being::setSprite(const unsigned int slot,
if (id1)
{
const ItemInfo &info = ItemDB::get(id1);
- if (!isTempSprite && mMap && mType == ActorType::Player)
+ if (isTempSprite == IsTempSprite_false &&
+ mMap &&
+ mType == ActorType::Player)
{
const BeingId pet = fromInt(info.getPet(), BeingId);
if (pet != BeingId_zero)
@@ -2538,7 +2541,8 @@ void Being::setSprite(const unsigned int slot,
int startTime = 0;
AnimatedSprite *restrict equipmentSprite = nullptr;
- if (!isTempSprite && mType == ActorType::Player)
+ if (isTempSprite == IsTempSprite_false &&
+ mType == ActorType::Player)
{
const BeingId pet = fromInt(info.getPet(), BeingId);
if (pet != BeingId_zero)
@@ -2581,7 +2585,7 @@ void Being::setSprite(const unsigned int slot,
}
}
- if (!isTempSprite)
+ if (isTempSprite == IsTempSprite_false)
{
mSpriteIDs[slot] = id;
mSpriteColors[slot] = color;
@@ -3377,7 +3381,7 @@ void Being::recalcSpritesOrder() restrict2
mSpriteColors[remSprite],
ItemColor_one,
IsWeapon_false,
- true);
+ IsTempSprite_true);
}
else
{
@@ -3386,7 +3390,7 @@ void Being::recalcSpritesOrder() restrict2
.getDyeColorsString(mHairColor),
ItemColor_one,
IsWeapon_false,
- true);
+ IsTempSprite_true);
}
updatedSprite[remSprite] = true;
}
@@ -3410,7 +3414,7 @@ void Being::recalcSpritesOrder() restrict2
mSpriteColors[slot2],
ItemColor_one,
IsWeapon_false,
- true);
+ IsTempSprite_true);
}
else
{
@@ -3420,7 +3424,7 @@ void Being::recalcSpritesOrder() restrict2
mHairColor),
ItemColor_one,
IsWeapon_false,
- true);
+ IsTempSprite_true);
}
updatedSprite[slot2] = true;
}
@@ -3567,7 +3571,7 @@ void Being::recalcSpritesOrder() restrict2
mSpriteColors[slot],
ItemColor_one,
IsWeapon_false,
- true);
+ IsTempSprite_true);
}
}
}
@@ -3584,7 +3588,7 @@ void Being::recalcSpritesOrder() restrict2
mSpriteColors[slot],
ItemColor_one,
IsWeapon_false,
- true);
+ IsTempSprite_true);
}
}
}
diff --git a/src/being/being.h b/src/being/being.h
index ad31cd144..b71f38c0a 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -28,6 +28,7 @@
#include "enums/gui/usercolorid.h"
+#include "enums/simpletypes/istempsprite.h"
#include "enums/simpletypes/isweapon.h"
#include "enums/simpletypes/move.h"
@@ -323,14 +324,16 @@ class Being notfinal : public ActorSprite,
std::string color = "",
const ItemColor colorId = ItemColor_one,
const IsWeapon isWeapon = IsWeapon_false,
- const bool isTempSprite = false) restrict2;
+ const IsTempSprite isTempSprite = IsTempSprite_false)
+ restrict2;
void updateSprite(const unsigned int slot,
const int id,
const std::string &restrict color = "",
const ItemColor colorId = ItemColor_one,
const IsWeapon isWeapon = IsWeapon_false,
- const bool isTempSprite = false) restrict2;
+ const IsTempSprite isTempSprite = IsTempSprite_false)
+ restrict2;
void setSpriteID(const unsigned int slot,
const int id) restrict2;
diff --git a/src/enums/simpletypes/istempsprite.h b/src/enums/simpletypes/istempsprite.h
new file mode 100644
index 000000000..8409690c8
--- /dev/null
+++ b/src/enums/simpletypes/istempsprite.h
@@ -0,0 +1,33 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2015-2016 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ENUMS_SIMPLETYPES_ISTEMPSPRITE_H
+#define ENUMS_SIMPLETYPES_ISTEMPSPRITE_H
+
+#include "enums/simpletypes/booldefines.h"
+
+PRAGMA6(GCC diagnostic push)
+PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable")
+
+defBoolEnum(IsTempSprite);
+
+PRAGMA6(GCC diagnostic pop)
+
+#endif // ENUMS_SIMPLETYPES_ISTEMPSPRITE_H
diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp
index 154243258..c37cf2f82 100644
--- a/src/net/ea/beingrecv.cpp
+++ b/src/net/ea/beingrecv.cpp
@@ -548,7 +548,7 @@ void BeingRecv::setSprite(Being *const being,
const std::string &color,
const ItemColor colorId,
const IsWeapon isWeapon,
- const bool isTempSprite)
+ const IsTempSprite isTempSprite)
{
if (!being)
return;
diff --git a/src/net/ea/beingrecv.h b/src/net/ea/beingrecv.h
index f68d87880..200059327 100644
--- a/src/net/ea/beingrecv.h
+++ b/src/net/ea/beingrecv.h
@@ -24,6 +24,7 @@
#define NET_EA_BEINGRECV_H
#include "enums/simpletypes/beingid.h"
+#include "enums/simpletypes/istempsprite.h"
#include "enums/simpletypes/isweapon.h"
#include "enums/simpletypes/itemcolor.h"
@@ -54,12 +55,13 @@ namespace Ea
void processBeingMove3(Net::MessageIn &msg);
Being *createBeing(const BeingId id,
const int job);
- void setSprite(Being *const being, const unsigned int slot,
+ void setSprite(Being *const being,
+ const unsigned int slot,
const int id,
const std::string &color = "",
const ItemColor colorId = ItemColor_one,
const IsWeapon isWeapon = IsWeapon_false,
- const bool isTempSprite = false);
+ const IsTempSprite isTempSprite = IsTempSprite_false);
} // namespace BeingRecv
} // namespace Ea