diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-05 20:58:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-05 20:58:21 +0300 |
commit | a87db81b6b7551a248e31e2850577aefda092538 (patch) | |
tree | f47c20512183113face758cf58ec71369c82806c /src/net/eathena | |
parent | 92c019dad798f1a84c5d3e8e8331a885f6458133 (diff) | |
download | plus-a87db81b6b7551a248e31e2850577aefda092538.tar.gz plus-a87db81b6b7551a248e31e2850577aefda092538.tar.bz2 plus-a87db81b6b7551a248e31e2850577aefda092538.tar.xz plus-a87db81b6b7551a248e31e2850577aefda092538.zip |
Replace most bools usage in playerinfo to strong typed bools.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/homunculushandler.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/homunculushandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/mercenaryhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/eathena/mercenaryhandler.h | 2 | ||||
-rw-r--r-- | src/net/eathena/playerhandler.cpp | 19 | ||||
-rw-r--r-- | src/net/eathena/playerhandler.h | 4 | ||||
-rw-r--r-- | src/net/eathena/tradehandler.cpp | 2 |
7 files changed, 20 insertions, 17 deletions
diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp index 13ba7ebe8..e3f83cd39 100644 --- a/src/net/eathena/homunculushandler.cpp +++ b/src/net/eathena/homunculushandler.cpp @@ -262,7 +262,7 @@ void HomunculusHandler::move(const int x, const int y) const 0U, "position"); } -void HomunculusHandler::attack(const int targetId, const bool keep) const +void HomunculusHandler::attack(const int targetId, const Keep keep) const { const int id = PlayerInfo::getHomunculusId(); if (!id) @@ -270,7 +270,7 @@ void HomunculusHandler::attack(const int targetId, const bool keep) const createOutPacket(CMSG_HOMMERC_ATTACK); outMsg.writeInt32(id, "homunculus id"); outMsg.writeInt32(targetId, "target id"); - outMsg.writeInt8(static_cast<int8_t>(keep ? 1 : 0), "keep"); + outMsg.writeInt8(static_cast<int8_t>(keep == Keep_true ? 1 : 0), "keep"); } void HomunculusHandler::feed() const diff --git a/src/net/eathena/homunculushandler.h b/src/net/eathena/homunculushandler.h index db992b5b3..5b288eeb6 100644 --- a/src/net/eathena/homunculushandler.h +++ b/src/net/eathena/homunculushandler.h @@ -45,7 +45,7 @@ class HomunculusHandler final : public MessageHandler, void move(const int x, const int y) const override final; - void attack(const int targetId, const bool keep) const override final; + void attack(const int targetId, const Keep keep) const override final; void feed() const override final; diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp index e93edcc0b..1bc35a72f 100644 --- a/src/net/eathena/mercenaryhandler.cpp +++ b/src/net/eathena/mercenaryhandler.cpp @@ -207,7 +207,7 @@ void MercenaryHandler::move(const int x, const int y) const 0U, "position"); } -void MercenaryHandler::attack(const int targetId, const bool keep) const +void MercenaryHandler::attack(const int targetId, const Keep keep) const { const int id = PlayerInfo::getMercenaryId(); if (!id) @@ -215,7 +215,7 @@ void MercenaryHandler::attack(const int targetId, const bool keep) const createOutPacket(CMSG_HOMMERC_ATTACK); outMsg.writeInt32(id, "mercenary id"); outMsg.writeInt32(targetId, "target id"); - outMsg.writeInt8(static_cast<int8_t>(keep ? 1 : 0), "keep"); + outMsg.writeInt8(static_cast<int8_t>(keep == Keep_true ? 1 : 0), "keep"); } void MercenaryHandler::talk(const std::string &restrict text) const diff --git a/src/net/eathena/mercenaryhandler.h b/src/net/eathena/mercenaryhandler.h index c1a784c3b..a24f414ff 100644 --- a/src/net/eathena/mercenaryhandler.h +++ b/src/net/eathena/mercenaryhandler.h @@ -45,7 +45,7 @@ class MercenaryHandler final : public MessageHandler, void move(const int x, const int y) const override final; - void attack(const int targetId, const bool keep) const override final; + void attack(const int targetId, const Keep keep) const override final; void talk(const std::string &restrict text) const override final; diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index b866dcb5c..a2bb8b83e 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -205,11 +205,11 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) } } -void PlayerHandler::attack(const int id, const bool keep) const +void PlayerHandler::attack(const int id, const Keep keep) const { createOutPacket(CMSG_PLAYER_CHANGE_ACT); outMsg.writeInt32(id, "target id"); - if (keep) + if (keep == Keep_true) outMsg.writeInt8(7, "action"); else outMsg.writeInt8(0, "action"); @@ -446,26 +446,29 @@ void PlayerHandler::processPlayerStatUpdate5(Net::MessageIn &msg) msg.readUInt8("luk cost"); } - PlayerInfo::setStatBase(Attributes::ATK, msg.readInt16("left atk"), false); + PlayerInfo::setStatBase(Attributes::ATK, + msg.readInt16("left atk"), Notify_false); PlayerInfo::setStatMod(Attributes::ATK, msg.readInt16("right atk")); PlayerInfo::updateAttrs(); val = msg.readInt16("right matk"); - PlayerInfo::setStatBase(Attributes::MATK, val, false); + PlayerInfo::setStatBase(Attributes::MATK, val, Notify_false); val = msg.readInt16("left matk"); PlayerInfo::setStatMod(Attributes::MATK, val); - PlayerInfo::setStatBase(Attributes::DEF, msg.readInt16("left def"), false); + PlayerInfo::setStatBase(Attributes::DEF, + msg.readInt16("left def"), Notify_false); PlayerInfo::setStatMod(Attributes::DEF, msg.readInt16("right def")); PlayerInfo::setStatBase(Attributes::MDEF, - msg.readInt16("left mdef"), false); + msg.readInt16("left mdef"), Notify_false); PlayerInfo::setStatMod(Attributes::MDEF, msg.readInt16("right mdef")); PlayerInfo::setStatBase(Attributes::HIT, msg.readInt16("hit")); - PlayerInfo::setStatBase(Attributes::FLEE, msg.readInt16("flee"), false); + PlayerInfo::setStatBase(Attributes::FLEE, + msg.readInt16("flee"), Notify_false); PlayerInfo::setStatMod(Attributes::FLEE, msg.readInt16("flee2/10")); PlayerInfo::setStatBase(Attributes::CRIT, msg.readInt16("crit/10")); @@ -577,7 +580,7 @@ void PlayerHandler::setStat(Net::MessageIn &msg, const int type, const int base, const int mod, - const bool notify) const + const Notify notify) const { Ea::PlayerHandler::setStat(msg, type, base, mod, notify); } diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h index bc2dab173..6d7d6a9e1 100644 --- a/src/net/eathena/playerhandler.h +++ b/src/net/eathena/playerhandler.h @@ -39,7 +39,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler void handleMessage(Net::MessageIn &msg) override final; - void attack(const int id, const bool keep) const override final; + void attack(const int id, const Keep keep) const override final; void stopAttack() const override final; void emote(const uint8_t emoteId) const override final; @@ -74,7 +74,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler const int type, const int base, const int mod, - const bool notify) const override final; + const Notify notify) const override final; static void processPlayerShortcuts(Net::MessageIn &msg); diff --git a/src/net/eathena/tradehandler.cpp b/src/net/eathena/tradehandler.cpp index a7a9c3300..5b1c92ac1 100644 --- a/src/net/eathena/tradehandler.cpp +++ b/src/net/eathena/tradehandler.cpp @@ -122,7 +122,7 @@ void TradeHandler::request(const Being *const being) const void TradeHandler::respond(const bool accept) const { if (!accept) - PlayerInfo::setTrading(false); + PlayerInfo::setTrading(Trading_false); createOutPacket(CMSG_TRADE_RESPONSE); outMsg.writeInt8(static_cast<int8_t>(accept ? 3 : 4), "accept"); |