diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-02 00:53:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-02 00:53:22 +0300 |
commit | 2f6f5950605e3ffe8054f3a2675f10032ca0aaf6 (patch) | |
tree | 8cbbc807f00bc4aeffc103058d223863c8de643f /src/net/eathena | |
parent | 28165cbeca05b74cf66f121757f21f4cb7cd381e (diff) | |
download | ManaVerse-2f6f5950605e3ffe8054f3a2675f10032ca0aaf6.tar.gz ManaVerse-2f6f5950605e3ffe8054f3a2675f10032ca0aaf6.tar.bz2 ManaVerse-2f6f5950605e3ffe8054f3a2675f10032ca0aaf6.tar.xz ManaVerse-2f6f5950605e3ffe8054f3a2675f10032ca0aaf6.zip |
improve guildhandler class.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/guildhandler.cpp | 33 | ||||
-rw-r--r-- | src/net/eathena/guildhandler.h | 29 |
2 files changed, 36 insertions, 26 deletions
diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index 13c0a1f2e..481a74236 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -191,15 +191,15 @@ void GuildHandler::handleMessage(Net::MessageIn &msg) } } -void GuildHandler::create(const std::string &name) +void GuildHandler::create(const std::string &name) const { MessageOut msg(CMSG_GUILD_CREATE); msg.writeInt32(0); // Unused msg.writeString(name, 24); } -void GuildHandler::invite(int guildId A_UNUSED, - const std::string &name A_UNUSED) +void GuildHandler::invite(const int guildId A_UNUSED, + const std::string &name A_UNUSED) const { if (!actorSpriteManager) return; @@ -215,7 +215,8 @@ void GuildHandler::invite(int guildId A_UNUSED, } } -void GuildHandler::invite(int guildId A_UNUSED, const Being *const being) +void GuildHandler::invite(const int guildId A_UNUSED, + const Being *const being) const { if (!being) return; @@ -226,7 +227,8 @@ void GuildHandler::invite(int guildId A_UNUSED, const Being *const being) msg.writeInt32(0); // Unused } -void GuildHandler::inviteResponse(int guildId, bool response) +void GuildHandler::inviteResponse(const int guildId, + const bool response) const { MessageOut msg(CMSG_GUILD_INVITE_REPLY); msg.writeInt32(guildId); @@ -235,7 +237,7 @@ void GuildHandler::inviteResponse(int guildId, bool response) msg.writeInt16(0); // Unused } -void GuildHandler::leave(int guildId) +void GuildHandler::leave(const int guildId) const { if (!player_node) return; @@ -247,7 +249,8 @@ void GuildHandler::leave(int guildId) msg.writeString("", 40); // Message } -void GuildHandler::kick(GuildMember *member, std::string reason) +void GuildHandler::kick(const GuildMember *const member, + const std::string &reason) const { if (!member || !member->getGuild()) return; @@ -259,19 +262,20 @@ void GuildHandler::kick(GuildMember *member, std::string reason) msg.writeString(reason, 40); // Message } -void GuildHandler::chat(int guildId A_UNUSED, const std::string &text) +void GuildHandler::chat(const int guildId A_UNUSED, + const std::string &text) const { if (!player_node) return; - std::string str = std::string(player_node->getName()).append( + const std::string str = std::string(player_node->getName()).append( " : ").append(text); MessageOut msg(CMSG_GUILD_MESSAGE); msg.writeInt16(static_cast<uint16_t>(str.size() + 4)); msg.writeString(str, static_cast<int>(str.length())); } -void GuildHandler::memberList(int guildId A_UNUSED) +void GuildHandler::memberList(const int guildId A_UNUSED) const { // TODO four types of info requests: // 0 = basic info + alliance info @@ -284,7 +288,7 @@ void GuildHandler::memberList(int guildId A_UNUSED) msg.writeInt32(1); // Request member list } -void GuildHandler::info(int guildId A_UNUSED) +void GuildHandler::info(const int guildId A_UNUSED) { // TODO four types of info requests: // 0 = basic info + alliance info @@ -298,7 +302,8 @@ void GuildHandler::info(int guildId A_UNUSED) msg.writeInt32(0); // Request basic info } -void GuildHandler::changeMemberPostion(GuildMember *member, int level) +void GuildHandler::changeMemberPostion(const GuildMember *const member, + const int level) const { if (!member || !member->getGuild()) return; @@ -310,8 +315,8 @@ void GuildHandler::changeMemberPostion(GuildMember *member, int level) msg.writeInt32(level); // pos } -void GuildHandler::changeNotice(int guildId, std::string msg1, - std::string msg2) +void GuildHandler::changeNotice(const int guildId, const std::string &msg1, + const std::string &msg2) const { MessageOut msg(CMSG_GUILD_CHANGE_NOTICE); msg.writeInt32(guildId); diff --git a/src/net/eathena/guildhandler.h b/src/net/eathena/guildhandler.h index 1508895fc..c25e8ff6f 100644 --- a/src/net/eathena/guildhandler.h +++ b/src/net/eathena/guildhandler.h @@ -40,29 +40,34 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler ~GuildHandler(); - void handleMessage(Net::MessageIn &msg); + void handleMessage(Net::MessageIn &msg) override; - void create(const std::string &name); + void create(const std::string &name) const override; - void invite(int guildId, const std::string &name); + void invite(const int guildId, const std::string &name) const override; - void invite(int guildId, const Being *const being); + void invite(const int guildId, + const Being *const being) const override; - void inviteResponse(int guildId, bool response); + void inviteResponse(const int guildId, + const bool response) const override; - void leave(int guildId); + void leave(const int guildId) const override; - void kick(GuildMember *member, std::string reason = ""); + void kick(const GuildMember *const member, + const std::string &reason = "") const override; - void chat(int guildId, const std::string &text); + void chat(const int guildId, const std::string &text) const override; - void memberList(int guildId); + void memberList(const int guildId) const override; - void info(int guildId); + void info(const int guildId) override; - void changeMemberPostion(GuildMember *member, int level); + void changeMemberPostion(const GuildMember *const member, + const int level) const override; - void changeNotice(int guildId, std::string msg1, std::string msg2); + void changeNotice(const int guildId, const std::string &msg1, + const std::string &msg2) const override; }; extern Ea::GuildTab *guildTab; |