summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-10 18:53:53 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-10 18:53:53 +0300
commit919d790980be710ec991af3654521225e97b5f79 (patch)
tree0d09d6d430502488fde4bd0841d8d5767af7d4f4 /src/net/eathena
parenta3635c94a9f1074736f243b0f7de7ab1c8aa14d0 (diff)
downloadplus-919d790980be710ec991af3654521225e97b5f79.tar.gz
plus-919d790980be710ec991af3654521225e97b5f79.tar.bz2
plus-919d790980be710ec991af3654521225e97b5f79.tar.xz
plus-919d790980be710ec991af3654521225e97b5f79.zip
improve playerhandler class.
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/playerhandler.cpp29
-rw-r--r--src/net/eathena/playerhandler.h31
2 files changed, 31 insertions, 29 deletions
diff --git a/src/net/eathena/playerhandler.cpp b/src/net/eathena/playerhandler.cpp
index 7a7bdff4f..3d80c2e1e 100644
--- a/src/net/eathena/playerhandler.cpp
+++ b/src/net/eathena/playerhandler.cpp
@@ -115,7 +115,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
}
}
-void PlayerHandler::attack(int id, bool keep)
+void PlayerHandler::attack(const int id, const bool keep) const
{
MessageOut outMsg(CMSG_PLAYER_ATTACK);
outMsg.writeInt32(id);
@@ -125,18 +125,18 @@ void PlayerHandler::attack(int id, bool keep)
outMsg.writeInt8(0);
}
-void PlayerHandler::stopAttack()
+void PlayerHandler::stopAttack() const
{
MessageOut outMsg(CMSG_PLAYER_STOP_ATTACK);
}
-void PlayerHandler::emote(uint8_t emoteId)
+void PlayerHandler::emote(const uint8_t emoteId) const
{
MessageOut outMsg(CMSG_PLAYER_EMOTE);
outMsg.writeInt8(emoteId);
}
-void PlayerHandler::increaseAttribute(int attr)
+void PlayerHandler::increaseAttribute(const int attr) const
{
if (attr >= STR && attr <= LUK)
{
@@ -146,7 +146,7 @@ void PlayerHandler::increaseAttribute(int attr)
}
}
-void PlayerHandler::increaseSkill(unsigned short skillId)
+void PlayerHandler::increaseSkill(const unsigned short skillId) const
{
if (PlayerInfo::getAttribute(PlayerInfo::SKILL_POINTS) <= 0)
return;
@@ -155,7 +155,7 @@ void PlayerHandler::increaseSkill(unsigned short skillId)
outMsg.writeInt16(skillId);
}
-void PlayerHandler::pickUp(const FloorItem *floorItem)
+void PlayerHandler::pickUp(const FloorItem *const floorItem) const
{
if (!floorItem)
return;
@@ -168,14 +168,15 @@ void PlayerHandler::pickUp(const FloorItem *floorItem)
handler->pushPickup(floorItem->getId());
}
-void PlayerHandler::setDirection(unsigned char direction)
+void PlayerHandler::setDirection(const unsigned char direction) const
{
MessageOut outMsg(CMSG_PLAYER_CHANGE_DIR);
outMsg.writeInt16(0);
outMsg.writeInt8(direction);
}
-void PlayerHandler::setDestination(int x, int y, int direction)
+void PlayerHandler::setDestination(const int x, const int y,
+ const int direction) const
{
MessageOut outMsg(CMSG_PLAYER_CHANGE_DEST);
outMsg.writeCoordinates(static_cast<short unsigned int>(x),
@@ -183,7 +184,7 @@ void PlayerHandler::setDestination(int x, int y, int direction)
static_cast<unsigned char>(direction));
}
-void PlayerHandler::changeAction(Being::Action action)
+void PlayerHandler::changeAction(const Being::Action action) const
{
unsigned char type;
switch (action)
@@ -208,24 +209,24 @@ void PlayerHandler::changeAction(Being::Action action)
outMsg.writeInt8(type);
}
-void PlayerHandler::respawn()
+void PlayerHandler::respawn() const
{
MessageOut outMsg(CMSG_PLAYER_RESTART);
outMsg.writeInt8(0);
}
-void PlayerHandler::requestOnlineList()
+void PlayerHandler::requestOnlineList() const
{
}
-void PlayerHandler::updateStatus(uint8_t status)
+void PlayerHandler::updateStatus(const uint8_t status) const
{
MessageOut outMsg(CMSG_SET_STATUS);
outMsg.writeInt8(status);
outMsg.writeInt8(0);
}
-void PlayerHandler::processPlayerShortcuts(Net::MessageIn &msg)
+void PlayerHandler::processPlayerShortcuts(Net::MessageIn &msg) const
{
for (int f = 0; f < 27; f ++)
{
@@ -235,7 +236,7 @@ void PlayerHandler::processPlayerShortcuts(Net::MessageIn &msg)
}
}
-void PlayerHandler::processPlayerShowEquip(Net::MessageIn &msg)
+void PlayerHandler::processPlayerShowEquip(Net::MessageIn &msg) const
{
msg.readInt8(); // show equip
}
diff --git a/src/net/eathena/playerhandler.h b/src/net/eathena/playerhandler.h
index 87bd2a7c6..ec8fcd5cb 100644
--- a/src/net/eathena/playerhandler.h
+++ b/src/net/eathena/playerhandler.h
@@ -40,26 +40,27 @@ class PlayerHandler final : public MessageHandler, public Ea::PlayerHandler
A_DELETE_COPY(PlayerHandler)
- void handleMessage(Net::MessageIn &msg);
+ void handleMessage(Net::MessageIn &msg) override;
- void attack(int id, bool keep);
- void stopAttack();
- void emote(uint8_t emoteId);
+ void attack(const int id, const bool keep) const override;
+ void stopAttack() const override;
+ void emote(const uint8_t emoteId) const override;
- void increaseAttribute(int attr);
- void increaseSkill(unsigned short skillId);
+ void increaseAttribute(const int attr) const override;
+ void increaseSkill(const unsigned short skillId) const override;
- void pickUp(const FloorItem *floorItem);
- void setDirection(unsigned char direction);
- void setDestination(int x, int y, int direction);
- void changeAction(Being::Action action);
- void updateStatus(uint8_t status);
+ void pickUp(const FloorItem *const floorItem) const override;
+ void setDirection(const unsigned char direction) const override;
+ void setDestination(const int x, const int y,
+ const int direction) const override;
+ void changeAction(const Being::Action action) const override;
+ void updateStatus(const uint8_t status) const override;
- void processPlayerShortcuts(Net::MessageIn &msg);
- void processPlayerShowEquip(Net::MessageIn &msg);
+ void processPlayerShortcuts(Net::MessageIn &msg) const;
+ void processPlayerShowEquip(Net::MessageIn &msg) const;
- void requestOnlineList();
- void respawn();
+ void requestOnlineList() const override;
+ void respawn() const override;
};
} // namespace EAthena