summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-10-06 20:15:51 +0300
committerAndrei Karas <akaras@inbox.ru>2014-10-06 20:15:51 +0300
commitd35d90b66e51679c6aabab6ef69217456d9c4f8b (patch)
tree3b9cdfc94ecc3146f4dfea345ec5b188252e1a4a /src/net/tmwa
parentdf15a278790cd17f626c1aab036608f6ed678471 (diff)
downloadmanaplus-d35d90b66e51679c6aabab6ef69217456d9c4f8b.tar.gz
manaplus-d35d90b66e51679c6aabab6ef69217456d9c4f8b.tar.bz2
manaplus-d35d90b66e51679c6aabab6ef69217456d9c4f8b.tar.xz
manaplus-d35d90b66e51679c6aabab6ef69217456d9c4f8b.zip
Move processGuildPositionInfo from ea namespace into eathena and tmwa.
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/guildhandler.cpp42
-rw-r--r--src/net/tmwa/guildhandler.h9
2 files changed, 50 insertions, 1 deletions
diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp
index d6ee27680..9445a4760 100644
--- a/src/net/tmwa/guildhandler.cpp
+++ b/src/net/tmwa/guildhandler.cpp
@@ -22,12 +22,17 @@
#include "net/tmwa/guildhandler.h"
#include "actormanager.h"
+#include "configuration.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
+#include "gui/windows/chatwindow.h"
+
#include "net/serverfeatures.h"
+#include "net/ea/gui/guildtab.h"
+
#include "net/tmwa/messageout.h"
#include "net/tmwa/protocol.h"
@@ -335,4 +340,41 @@ void GuildHandler::checkMaster() const
MessageOut msg(CMSG_GUILD_CHECK_MASTER);
}
+void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) const
+{
+ const int guildId = msg.readInt32();
+ const int emblem = msg.readInt32();
+ const int posMode = msg.readInt32();
+ msg.readInt32(); // Unused
+ msg.readUInt8(); // Unused
+ std::string guildName = msg.readString(24);
+
+ Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId));
+ if (!g)
+ return;
+
+ g->setName(guildName);
+ g->setEmblemId(emblem);
+ if (!Ea::taGuild)
+ Ea::taGuild = g;
+ if (!Ea::guildTab && chatWindow)
+ {
+ Ea::guildTab = new Ea::GuildTab(chatWindow);
+ if (config.getBoolValue("showChatHistory"))
+ Ea::guildTab->loadFromLogFile("#Guild");
+ if (localPlayer)
+ localPlayer->addGuild(Ea::taGuild);
+ memberList(guildId);
+ }
+
+ if (localPlayer)
+ {
+ localPlayer->setGuild(g);
+ localPlayer->setGuildName(g->getName());
+ }
+
+ logger->log("Guild position info: %d %d %d %s\n", guildId,
+ emblem, posMode, guildName.c_str());
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h
index f1422c7a1..b92513919 100644
--- a/src/net/tmwa/guildhandler.h
+++ b/src/net/tmwa/guildhandler.h
@@ -72,10 +72,17 @@ class GuildHandler final : public Ea::GuildHandler, public MessageHandler
const override final;
void checkMaster() const;
+
+ protected:
+ void processGuildPositionInfo(Net::MessageIn &msg) const;
};
extern Ea::GuildTab *guildTab;
- extern Guild *taGuild;
} // namespace TmwAthena
+namespace Ea
+{
+ extern Guild *taGuild;
+}
+
#endif // NET_TMWA_GUILDHANDLER_H