summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/actormanager.cpp2
-rw-r--r--src/being/being.cpp20
-rw-r--r--src/being/being.h5
-rw-r--r--src/enums/simpletypes/isweapon.h33
-rw-r--r--src/net/ea/beingrecv.cpp2
-rw-r--r--src/net/ea/beingrecv.h3
-rw-r--r--src/net/eathena/beingrecv.cpp30
-rw-r--r--src/net/eathena/charserverrecv.cpp6
-rw-r--r--src/net/tmwa/beingrecv.cpp40
-rw-r--r--src/net/tmwa/charserverrecv.cpp6
12 files changed, 117 insertions, 32 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6984556c4..54f6c9dfb 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/isweapon.h
enums/simpletypes/itemcolor.h
enums/simpletypes/keep.h
enums/simpletypes/mainconfig.h
diff --git a/src/Makefile.am b/src/Makefile.am
index b262d71ba..3018e0668 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/isweapon.h \
enums/simpletypes/itemcolor.h \
enums/simpletypes/keep.h \
enums/simpletypes/mainconfig.h \
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 82be50ea8..0cfd9571d 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -2038,7 +2038,7 @@ Being *ActorManager::cloneBeing(const Being *const srcBeing,
{
const int spriteId = srcBeing->getSpriteID(slot);
const ItemColor color = srcBeing->getSpriteColor(slot);
- dstBeing->setSprite(slot, spriteId, "", color, false);
+ dstBeing->setSprite(slot, spriteId, "", color, IsWeapon_false);
}
const int hairSlot = charServerHandler->hairSprite();
const int hairStyle = -srcBeing->getSpriteID(hairSlot);
diff --git a/src/being/being.cpp b/src/being/being.cpp
index cec64c269..1a6e14fc4 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -2468,7 +2468,7 @@ void Being::updateSprite(const unsigned int slot,
const int id,
const std::string &restrict color,
const ItemColor colorId,
- const bool isWeapon,
+ const IsWeapon isWeapon,
const bool isTempSprite) restrict2
{
if (!charServerHandler || slot >= charServerHandler->maxSprite())
@@ -2486,7 +2486,7 @@ void Being::setSprite(const unsigned int slot,
const int id,
std::string color,
const ItemColor colorId,
- const bool isWeapon,
+ const IsWeapon isWeapon,
const bool isTempSprite) restrict2
{
if (!charServerHandler || slot >= charServerHandler->maxSprite())
@@ -2514,7 +2514,7 @@ void Being::setSprite(const unsigned int slot,
removeSprite(slot);
mSpriteDraw[slot] = 0;
- if (isWeapon)
+ if (isWeapon == IsWeapon_true)
mEquippedWeapon = nullptr;
const int id1 = mSpriteIDs[slot];
if (id1)
@@ -2567,7 +2567,7 @@ void Being::setSprite(const unsigned int slot,
addItemParticles(id, info.getDisplay());
- if (isWeapon)
+ if (isWeapon == IsWeapon_true)
mEquippedWeapon = &ItemDB::get(id);
setAction(mAction, 0);
@@ -3376,7 +3376,7 @@ void Being::recalcSpritesOrder() restrict2
setSprite(remSprite, repIt->second,
mSpriteColors[remSprite],
ItemColor_one,
- false,
+ IsWeapon_false,
true);
}
else
@@ -3385,7 +3385,7 @@ void Being::recalcSpritesOrder() restrict2
ItemDB::get(repIt->second)
.getDyeColorsString(mHairColor),
ItemColor_one,
- false,
+ IsWeapon_false,
true);
}
updatedSprite[remSprite] = true;
@@ -3409,7 +3409,7 @@ void Being::recalcSpritesOrder() restrict2
setSprite(slot2, repIt->second,
mSpriteColors[slot2],
ItemColor_one,
- false,
+ IsWeapon_false,
true);
}
else
@@ -3419,7 +3419,7 @@ void Being::recalcSpritesOrder() restrict2
.getDyeColorsString(
mHairColor),
ItemColor_one,
- false,
+ IsWeapon_false,
true);
}
updatedSprite[slot2] = true;
@@ -3566,7 +3566,7 @@ void Being::recalcSpritesOrder() restrict2
id,
mSpriteColors[slot],
ItemColor_one,
- false,
+ IsWeapon_false,
true);
}
}
@@ -3583,7 +3583,7 @@ void Being::recalcSpritesOrder() restrict2
id,
mSpriteColors[slot],
ItemColor_one,
- false,
+ IsWeapon_false,
true);
}
}
diff --git a/src/being/being.h b/src/being/being.h
index 296038876..ad31cd144 100644
--- a/src/being/being.h
+++ b/src/being/being.h
@@ -28,6 +28,7 @@
#include "enums/gui/usercolorid.h"
+#include "enums/simpletypes/isweapon.h"
#include "enums/simpletypes/move.h"
#include "resources/beinginfo.h"
@@ -321,14 +322,14 @@ class Being notfinal : public ActorSprite,
const int id,
std::string color = "",
const ItemColor colorId = ItemColor_one,
- const bool isWeapon = false,
+ const IsWeapon isWeapon = IsWeapon_false,
const bool isTempSprite = false) restrict2;
void updateSprite(const unsigned int slot,
const int id,
const std::string &restrict color = "",
const ItemColor colorId = ItemColor_one,
- const bool isWeapon = false,
+ const IsWeapon isWeapon = IsWeapon_false,
const bool isTempSprite = false) restrict2;
void setSpriteID(const unsigned int slot,
diff --git a/src/enums/simpletypes/isweapon.h b/src/enums/simpletypes/isweapon.h
new file mode 100644
index 000000000..69cf3053e
--- /dev/null
+++ b/src/enums/simpletypes/isweapon.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_ISWEAPON_H
+#define ENUMS_SIMPLETYPES_ISWEAPON_H
+
+#include "enums/simpletypes/booldefines.h"
+
+PRAGMA6(GCC diagnostic push)
+PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable")
+
+defBoolEnum(IsWeapon);
+
+PRAGMA6(GCC diagnostic pop)
+
+#endif // ENUMS_SIMPLETYPES_ISWEAPON_H
diff --git a/src/net/ea/beingrecv.cpp b/src/net/ea/beingrecv.cpp
index 7b8d74328..154243258 100644
--- a/src/net/ea/beingrecv.cpp
+++ b/src/net/ea/beingrecv.cpp
@@ -547,7 +547,7 @@ void BeingRecv::setSprite(Being *const being,
const int id,
const std::string &color,
const ItemColor colorId,
- const bool isWeapon,
+ const IsWeapon isWeapon,
const bool isTempSprite)
{
if (!being)
diff --git a/src/net/ea/beingrecv.h b/src/net/ea/beingrecv.h
index 9c98ba12e..f68d87880 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/isweapon.h"
#include "enums/simpletypes/itemcolor.h"
#include <string>
@@ -57,7 +58,7 @@ namespace Ea
const int id,
const std::string &color = "",
const ItemColor colorId = ItemColor_one,
- const bool isWeapon = false,
+ const IsWeapon isWeapon = IsWeapon_false,
const bool isTempSprite = false);
} // namespace BeingRecv
} // namespace Ea
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index 5d4c59d00..07779147a 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -160,7 +160,11 @@ void BeingRecv::processBeingChangeLookContinue(const Net::MessageIn &msg,
dstBeing->setSpriteID(SPRITE_HAIR_COLOR, id * -1);
break;
case 2: // LOOK_WEAPON Weapon ID in id, Shield ID in id2
- dstBeing->setSprite(SPRITE_BODY, id, "", itemColor, true);
+ dstBeing->setSprite(SPRITE_BODY,
+ id,
+ "",
+ itemColor,
+ IsWeapon_true);
dstBeing->setSprite(SPRITE_FLOOR, id2);
if (localPlayer)
localPlayer->imitateOutfit(dstBeing, SPRITE_FLOOR);
@@ -399,8 +403,12 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
Ea::BeingRecv::setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_HAIR, shoes);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_SHOES, gloves);
- Ea::BeingRecv::setSprite(dstBeing, SPRITE_BODY, weapon, "",
- ItemColor_one, true);
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_BODY,
+ weapon,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
// Ea::BeingRecv::setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
@@ -601,8 +609,12 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg)
Ea::BeingRecv::setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_HAIR, shoes);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_SHOES, gloves);
- Ea::BeingRecv::setSprite(dstBeing, SPRITE_BODY, weapon, "",
- ItemColor_one, true);
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_BODY,
+ weapon,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
}
// Ea::BeingRecv::setSprite(dstBeing, SPRITE_FLOOR, shield);
}
@@ -801,8 +813,12 @@ void BeingRecv::processBeingSpawn(Net::MessageIn &msg)
Ea::BeingRecv::setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_HAIR, shoes);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_SHOES, gloves);
- Ea::BeingRecv::setSprite(dstBeing, SPRITE_BODY, weapon, "",
- ItemColor_one, true);
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_BODY,
+ weapon,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
// Ea::BeingRecv::setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp
index fcf90acc9..598602355 100644
--- a/src/net/eathena/charserverrecv.cpp
+++ b/src/net/eathena/charserverrecv.cpp
@@ -129,7 +129,11 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg,
const int option A_UNUSED = (msg.readInt16("weapon") | 1) ^ 1;
const int weapon = 0;
- tempPlayer->setSprite(SPRITE_BODY, weapon, "", ItemColor_one, true);
+ tempPlayer->setSprite(SPRITE_BODY,
+ weapon,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
data.mAttributes[Attributes::LEVEL] = msg.readInt16("level");
diff --git a/src/net/tmwa/beingrecv.cpp b/src/net/tmwa/beingrecv.cpp
index cb5eefd92..5eec60985 100644
--- a/src/net/tmwa/beingrecv.cpp
+++ b/src/net/tmwa/beingrecv.cpp
@@ -143,7 +143,11 @@ void BeingRecv::processBeingChangeLookContinue(const Net::MessageIn &msg,
break;
}
case 2: // Weapon ID in id, Shield ID in id2
- dstBeing->setSprite(SPRITE_BODY, id, "", ItemColor_one, true);
+ dstBeing->setSprite(SPRITE_BODY,
+ id,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
dstBeing->setSprite(SPRITE_FLOOR, id2);
localPlayer->imitateOutfit(dstBeing, SPRITE_FLOOR);
break;
@@ -311,7 +315,11 @@ void BeingRecv::processPlayerUpdate1(Net::MessageIn &msg)
if (!disguiseId)
{
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->updateSprite(SPRITE_BODY, weapon, "", ItemColor_one, true);
+ dstBeing->updateSprite(SPRITE_BODY,
+ weapon,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
dstBeing->updateSprite(SPRITE_FLOOR, shield);
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
@@ -453,7 +461,11 @@ void BeingRecv::processPlayerUpdate2(Net::MessageIn &msg)
if (!disguiseId)
{
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->updateSprite(SPRITE_BODY, weapon, "", ItemColor_one, true);
+ dstBeing->updateSprite(SPRITE_BODY,
+ weapon,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
dstBeing->updateSprite(SPRITE_FLOOR, shield);
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
@@ -595,7 +607,11 @@ void BeingRecv::processPlayerMove(Net::MessageIn &msg)
if (!disguiseId)
{
// Set these after the gender, as the sprites may be gender-specific
- dstBeing->updateSprite(SPRITE_BODY, weapon, "", ItemColor_one, true);
+ dstBeing->updateSprite(SPRITE_BODY,
+ weapon,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
dstBeing->updateSprite(SPRITE_FLOOR, shield);
dstBeing->updateSprite(SPRITE_WEAPON, headBottom);
dstBeing->updateSprite(SPRITE_HEAD_BOTTOM, headMid);
@@ -844,8 +860,12 @@ void BeingRecv::processBeingVisible(Net::MessageIn &msg)
Ea::BeingRecv::setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_HAIR, shoes);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_SHOES, gloves);
- Ea::BeingRecv::setSprite(dstBeing, SPRITE_BODY, weapon, "",
- ItemColor_one, true);
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_BODY,
+ weapon,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
@@ -1057,8 +1077,12 @@ void BeingRecv::processBeingMove(Net::MessageIn &msg)
Ea::BeingRecv::setSprite(dstBeing, SPRITE_CLOTHES_COLOR, headTop);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_HAIR, shoes);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_SHOES, gloves);
- Ea::BeingRecv::setSprite(dstBeing, SPRITE_BODY, weapon, "",
- ItemColor_one, true);
+ Ea::BeingRecv::setSprite(dstBeing,
+ SPRITE_BODY,
+ weapon,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
Ea::BeingRecv::setSprite(dstBeing, SPRITE_FLOOR, shield);
}
else if (dstBeing->getType() == ActorType::Npc
diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp
index 428693678..18c0ab791 100644
--- a/src/net/tmwa/charserverrecv.cpp
+++ b/src/net/tmwa/charserverrecv.cpp
@@ -104,7 +104,11 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg,
const uint16_t look = msg.readUInt8("look");
tempPlayer->setSubtype(fromInt(race, BeingTypeId), look);
const uint16_t weapon = msg.readInt16("weapon");
- tempPlayer->setSprite(SPRITE_BODY, weapon, "", ItemColor_one, true);
+ tempPlayer->setSprite(SPRITE_BODY,
+ weapon,
+ "",
+ ItemColor_one,
+ IsWeapon_true);
data.mAttributes[Attributes::LEVEL] = msg.readInt16("level");