From 3411edb5d3ae07d247421e4b8f7936a22b7b4027 Mon Sep 17 00:00:00 2001 From: Andrei Karas <akaras@inbox.ru> Date: Fri, 29 May 2015 21:42:33 +0300 Subject: Convert Attributes enum into strong typed enum. --- src/net/eathena/charserverhandler.cpp | 11 ++++++----- src/net/eathena/playerhandler.cpp | 2 +- src/net/eathena/playerhandler.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) (limited to 'src/net/eathena') diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 76005d968..94530f407 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -257,11 +257,12 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, character->dummy = tempPlayer; - for (int i = 0; i < 6; i++) - { - character->data.mStats[i + Attributes::STR].base - = msg.readUInt8("stat"); - } + character->data.mStats[Attributes::STR].base = msg.readUInt8("str"); + character->data.mStats[Attributes::AGI].base = msg.readUInt8("agi"); + character->data.mStats[Attributes::VIT].base = msg.readUInt8("vit"); + character->data.mStats[Attributes::INT].base = msg.readUInt8("int"); + character->data.mStats[Attributes::DEX].base = msg.readUInt8("dex"); + character->data.mStats[Attributes::LUK].base = msg.readUInt8("luk"); character->slot = msg.readInt16("character slot id"); msg.readInt16("rename"); diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp index a4e4586f2..f2627c605 100644 --- a/src/net/eathena/playerhandler.cpp +++ b/src/net/eathena/playerhandler.cpp @@ -227,7 +227,7 @@ void PlayerHandler::emote(const uint8_t emoteId) const outMsg.writeInt8(emoteId, "emote id"); } -void PlayerHandler::increaseAttribute(const int attr) const +void PlayerHandler::increaseAttribute(const AttributesT attr) const { if (attr >= Attributes::STR && attr <= Attributes::LUK) { diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h index fc84db326..49572f0b1 100644 --- a/src/net/eathena/playerhandler.h +++ b/src/net/eathena/playerhandler.h @@ -44,7 +44,7 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler void stopAttack() const override final; void emote(const uint8_t emoteId) const override final; - void increaseAttribute(const int attr) const override final; + void increaseAttribute(const AttributesT attr) const override final; void increaseSkill(const uint16_t skillId) const override final; void pickUp(const FloorItem *const floorItem) const override final; -- cgit v1.2.3-70-g09d2