summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-04-02 00:53:22 +0300
committerAndrei Karas <akaras@inbox.ru>2013-04-02 00:53:22 +0300
commit2f6f5950605e3ffe8054f3a2675f10032ca0aaf6 (patch)
tree8cbbc807f00bc4aeffc103058d223863c8de643f /src/net/tmwa
parent28165cbeca05b74cf66f121757f21f4cb7cd381e (diff)
downloadManaVerse-2f6f5950605e3ffe8054f3a2675f10032ca0aaf6.tar.gz
ManaVerse-2f6f5950605e3ffe8054f3a2675f10032ca0aaf6.tar.bz2
ManaVerse-2f6f5950605e3ffe8054f3a2675f10032ca0aaf6.tar.xz
ManaVerse-2f6f5950605e3ffe8054f3a2675f10032ca0aaf6.zip
improve guildhandler class.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/guildhandler.cpp32
-rw-r--r--src/net/tmwa/guildhandler.h28
2 files changed, 34 insertions, 26 deletions
diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp
index 4e1ceba08..a21ef726f 100644
--- a/src/net/tmwa/guildhandler.cpp
+++ b/src/net/tmwa/guildhandler.cpp
@@ -193,15 +193,15 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
BLOCK_END("GuildHandler::handleMessage")
}
-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;
@@ -217,7 +217,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;
@@ -228,7 +229,7 @@ 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);
@@ -237,7 +238,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;
@@ -249,7 +250,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;
@@ -261,19 +263,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
@@ -286,7 +289,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
@@ -300,7 +303,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;
@@ -312,8 +316,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/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h
index 2c2bf4fde..c4c6cf285 100644
--- a/src/net/tmwa/guildhandler.h
+++ b/src/net/tmwa/guildhandler.h
@@ -40,29 +40,33 @@ 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;