diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-10 20:54:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-10 20:54:27 +0300 |
commit | fc199c3ae60d4c4cf76236c7f4891113daa3cbc4 (patch) | |
tree | 0ecb3d397a9224c280bebfa22aeb1588edf63371 /src | |
parent | b748c8947e6225376e77b09f4c7c335985d934ef (diff) | |
download | mv-fc199c3ae60d4c4cf76236c7f4891113daa3cbc4.tar.gz mv-fc199c3ae60d4c4cf76236c7f4891113daa3cbc4.tar.bz2 mv-fc199c3ae60d4c4cf76236c7f4891113daa3cbc4.tar.xz mv-fc199c3ae60d4c4cf76236c7f4891113daa3cbc4.zip |
improve skillhandler class.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/ea/skillhandler.cpp | 11 | ||||
-rw-r--r-- | src/net/ea/skillhandler.h | 10 | ||||
-rw-r--r-- | src/net/eathena/skillhandler.cpp | 8 | ||||
-rw-r--r-- | src/net/eathena/skillhandler.h | 10 | ||||
-rw-r--r-- | src/net/skillhandler.h | 10 | ||||
-rw-r--r-- | src/net/tmwa/skillhandler.cpp | 7 | ||||
-rw-r--r-- | src/net/tmwa/skillhandler.h | 10 |
7 files changed, 32 insertions, 34 deletions
diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index ed2b1973d..1e517a729 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -71,12 +71,7 @@ SkillHandler::SkillHandler() { } -void SkillHandler::use(int id A_UNUSED) -{ - // TODO -} - -void SkillHandler::processPlayerSkills(Net::MessageIn &msg) +void SkillHandler::processPlayerSkills(Net::MessageIn &msg) const { msg.readInt16(); // length const int skillCount = (msg.getLength() - 4) / 37; @@ -106,7 +101,7 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) skillDialog->playUpdateEffect(updateSkill); } -void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) +void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) const { const int skillId = msg.readInt16(); const int level = msg.readInt16(); @@ -124,7 +119,7 @@ void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) } } -void SkillHandler::processSkillFailed(Net::MessageIn &msg) +void SkillHandler::processSkillFailed(Net::MessageIn &msg) const { // Action failed (ex. sit because you have not reached the // right level) diff --git a/src/net/ea/skillhandler.h b/src/net/ea/skillhandler.h index c07cb7c46..f0be31d58 100644 --- a/src/net/ea/skillhandler.h +++ b/src/net/ea/skillhandler.h @@ -37,15 +37,11 @@ class SkillHandler : public Net::SkillHandler A_DELETE_COPY(SkillHandler) - void handleMessage(Net::MessageIn &msg); + void processPlayerSkills(Net::MessageIn &msg) const; - void use(int id); + void processPlayerSkillUp(Net::MessageIn &msg) const; - void processPlayerSkills(Net::MessageIn &msg); - - void processPlayerSkillUp(Net::MessageIn &msg); - - void processSkillFailed(Net::MessageIn &msg); + void processSkillFailed(Net::MessageIn &msg) const; }; } // namespace Ea diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index a36ba7435..75aae7608 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -69,7 +69,8 @@ void SkillHandler::handleMessage(Net::MessageIn &msg) } } -void SkillHandler::useBeing(int id, int level, int beingId) +void SkillHandler::useBeing(const int id, const int level, + const int beingId) const { MessageOut outMsg(CMSG_SKILL_USE_BEING); outMsg.writeInt16(static_cast<int16_t>(id)); @@ -77,7 +78,8 @@ void SkillHandler::useBeing(int id, int level, int beingId) outMsg.writeInt32(beingId); } -void SkillHandler::usePos(int id, int level, int x, int y) +void SkillHandler::usePos(const int id, const int level, + const int x, const int y) const { MessageOut outMsg(CMSG_SKILL_USE_POSITION); outMsg.writeInt16(static_cast<int16_t>(level)); @@ -86,7 +88,7 @@ void SkillHandler::usePos(int id, int level, int x, int y) outMsg.writeInt16(static_cast<int16_t>(y)); } -void SkillHandler::useMap(int id, const std::string &map) +void SkillHandler::useMap(const int id, const std::string &map) const { MessageOut outMsg(CMSG_SKILL_USE_MAP); outMsg.writeInt16(static_cast<int16_t>(id)); diff --git a/src/net/eathena/skillhandler.h b/src/net/eathena/skillhandler.h index be2025da7..a44718d3f 100644 --- a/src/net/eathena/skillhandler.h +++ b/src/net/eathena/skillhandler.h @@ -40,13 +40,15 @@ class SkillHandler final : public MessageHandler, public Ea::SkillHandler A_DELETE_COPY(SkillHandler) - void handleMessage(Net::MessageIn &msg); + void handleMessage(Net::MessageIn &msg) override; - void useBeing(int id, int level, int beingId); + void useBeing(const int id, const int level, + const int beingId) const override; - void usePos(int id, int level, int x, int y); + void usePos(const int id, const int level, + const int x, const int y) const override; - void useMap(int id, const std::string &map); + void useMap(const int id, const std::string &map) const override; }; } // namespace EAthena diff --git a/src/net/skillhandler.h b/src/net/skillhandler.h index fa044ebd6..6e8b786a9 100644 --- a/src/net/skillhandler.h +++ b/src/net/skillhandler.h @@ -33,13 +33,13 @@ class SkillHandler virtual ~SkillHandler () { } - virtual void use(int id) = 0; + virtual void useBeing(const int id, const int level, + const int beingId) const = 0; - virtual void useBeing(int id, int level, int beingId) = 0; + virtual void usePos(const int id, const int level, + const int x, const int y) const = 0; - virtual void usePos(int id, int level, int x, int y) = 0; - - virtual void useMap(int id, const std::string &map) = 0; + virtual void useMap(const int id, const std::string &map) const = 0; }; } diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp index 72ab4b6ec..9dd6af1fe 100644 --- a/src/net/tmwa/skillhandler.cpp +++ b/src/net/tmwa/skillhandler.cpp @@ -71,7 +71,7 @@ void SkillHandler::handleMessage(Net::MessageIn &msg) BLOCK_END("SkillHandler::handleMessage") } -void SkillHandler::useBeing(int id, int level, int beingId) +void SkillHandler::useBeing(const int id, const int level, const int beingId) const { MessageOut outMsg(CMSG_SKILL_USE_BEING); outMsg.writeInt16(static_cast<int16_t>(id)); @@ -79,7 +79,8 @@ void SkillHandler::useBeing(int id, int level, int beingId) outMsg.writeInt32(beingId); } -void SkillHandler::usePos(int id, int level, int x, int y) +void SkillHandler::usePos(const int id, const int level, + const int x, const int y) const { MessageOut outMsg(CMSG_SKILL_USE_POSITION); outMsg.writeInt16(static_cast<int16_t>(level)); @@ -88,7 +89,7 @@ void SkillHandler::usePos(int id, int level, int x, int y) outMsg.writeInt16(static_cast<int16_t>(y)); } -void SkillHandler::useMap(int id, const std::string &map) +void SkillHandler::useMap(const int id, const std::string &map) const { MessageOut outMsg(CMSG_SKILL_USE_MAP); outMsg.writeInt16(static_cast<int16_t>(id)); diff --git a/src/net/tmwa/skillhandler.h b/src/net/tmwa/skillhandler.h index a7db40a2d..12a6021e5 100644 --- a/src/net/tmwa/skillhandler.h +++ b/src/net/tmwa/skillhandler.h @@ -40,13 +40,15 @@ class SkillHandler final : public MessageHandler, public Ea::SkillHandler A_DELETE_COPY(SkillHandler) - void handleMessage(Net::MessageIn &msg); + void handleMessage(Net::MessageIn &msg) override; - void useBeing(int id, int level, int beingId); + void useBeing(const int id, const int level, + const int beingId) const override; - void usePos(int id, int level, int x, int y); + void usePos(const int id, const int level, + const int x, const int y) const override; - void useMap(int id, const std::string &map); + void useMap(const int id, const std::string &map) const override; }; } // namespace TmwAthena |