diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-29 21:42:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-29 22:43:38 +0300 |
commit | 3411edb5d3ae07d247421e4b8f7936a22b7b4027 (patch) | |
tree | 63685d0979938a42a62b3f0a880663bb06f4e8ca /src/net/ea | |
parent | 390e5da0f9ecc4407aa7d4bcba1af5730db56271 (diff) | |
download | manaverse-3411edb5d3ae07d247421e4b8f7936a22b7b4027.tar.gz manaverse-3411edb5d3ae07d247421e4b8f7936a22b7b4027.tar.bz2 manaverse-3411edb5d3ae07d247421e4b8f7936a22b7b4027.tar.xz manaverse-3411edb5d3ae07d247421e4b8f7936a22b7b4027.zip |
Convert Attributes enum into strong typed enum.
Diffstat (limited to 'src/net/ea')
-rw-r--r-- | src/net/ea/playerhandler.cpp | 7 | ||||
-rw-r--r-- | src/net/ea/playerhandler.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 0003a0a7e..8d4937236 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -61,7 +61,7 @@ PlayerHandler::PlayerHandler() { } -void PlayerHandler::decreaseAttribute(const int attr A_UNUSED) const +void PlayerHandler::decreaseAttribute(const AttributesT attr A_UNUSED) const { } @@ -198,13 +198,14 @@ void PlayerHandler::processPlayerStatUpdate3(Net::MessageIn &msg) void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) { BLOCK_START("PlayerHandler::processPlayerStatUpdate4") - const int type = msg.readInt16("type"); + const uint16_t type = msg.readInt16("type"); const uint8_t ok = msg.readUInt8("flag"); const int value = msg.readUInt8("value"); if (ok != 1) { - const int oldValue = PlayerInfo::getStatBase(type); + const int oldValue = PlayerInfo::getStatBase( + static_cast<AttributesT>(type)); const int points = PlayerInfo::getAttribute(Attributes::CHAR_POINTS) + oldValue - value; PlayerInfo::setAttribute(Attributes::CHAR_POINTS, points); diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h index 760f52af7..4f443c8bf 100644 --- a/src/net/ea/playerhandler.h +++ b/src/net/ea/playerhandler.h @@ -42,7 +42,7 @@ class PlayerHandler notfinal : public Net::PlayerHandler A_DELETE_COPY(PlayerHandler) - void decreaseAttribute(const int attr) const override final; + void decreaseAttribute(const AttributesT attr) const override final; void ignorePlayer(const std::string &player, const bool ignore) const override final; |