From 3411edb5d3ae07d247421e4b8f7936a22b7b4027 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 29 May 2015 21:42:33 +0300 Subject: Convert Attributes enum into strong typed enum. --- src/net/ea/playerhandler.cpp | 7 ++++--- src/net/ea/playerhandler.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/net/ea') 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(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; -- cgit v1.2.3-70-g09d2