diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-10-06 21:24:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-10-06 23:40:01 +0300 |
commit | c623250fbc8524a1ab78791595bf1fc4344fec49 (patch) | |
tree | a0a0fb07bf5de4e494d50b214418b1ec99787dce | |
parent | ff516ba3e0459cce11d6b43d4686a1c3c43a6605 (diff) | |
download | mv-c623250fbc8524a1ab78791595bf1fc4344fec49.tar.gz mv-c623250fbc8524a1ab78791595bf1fc4344fec49.tar.bz2 mv-c623250fbc8524a1ab78791595bf1fc4344fec49.tar.xz mv-c623250fbc8524a1ab78791595bf1fc4344fec49.zip |
read guild position flags.
-rw-r--r-- | src/being/playerinfo.cpp | 11 | ||||
-rw-r--r-- | src/being/playerinfo.h | 5 | ||||
-rw-r--r-- | src/guild.cpp | 4 | ||||
-rw-r--r-- | src/guild.h | 6 | ||||
-rw-r--r-- | src/guildpositionflags.h | 3 | ||||
-rw-r--r-- | src/net/eathena/guildhandler.cpp | 16 | ||||
-rw-r--r-- | src/net/tmwa/guildhandler.cpp | 14 |
7 files changed, 39 insertions, 20 deletions
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index 4f7b714cf..0000825fe 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -61,6 +61,7 @@ Equipment *mEquipment = nullptr; MercenaryInfo *mMercenary = nullptr; HomunculusInfo *mHomunculus = nullptr; PetInfo *mPet = nullptr; +GuildPositionFlags::Type mGuildPositionFlags = GuildPositionFlags::None; bool mTrading = false; int mLevelProgress = 0; @@ -556,4 +557,14 @@ void updateAttackAi(const int targetId, const bool keep) homunculusHandler->attack(targetId, keep); } +void setGuildPositionFlags(const GuildPositionFlags::Type pos) +{ + mGuildPositionFlags = pos; +} + +GuildPositionFlags::Type getGuildPositionFlags() +{ + return mGuildPositionFlags; +} + } // namespace PlayerInfo diff --git a/src/being/playerinfo.h b/src/being/playerinfo.h index c4ccfd4be..e3b156d9e 100644 --- a/src/being/playerinfo.h +++ b/src/being/playerinfo.h @@ -23,6 +23,7 @@ #define BEING_PLAYERINFO_H #include "equipment.h" +#include "guildpositionflags.h" #include "state.h" #include <map> @@ -264,6 +265,10 @@ namespace PlayerInfo void updateMoveAI(); void updateAttackAi(const int targetId, const bool keep); + + void setGuildPositionFlags(const GuildPositionFlags::Type pos); + + GuildPositionFlags::Type getGuildPositionFlags(); } // namespace PlayerInfo #endif // BEING_PLAYERINFO_H diff --git a/src/guild.cpp b/src/guild.cpp index a6e5c5ad7..fd1f99b28 100644 --- a/src/guild.cpp +++ b/src/guild.cpp @@ -89,11 +89,11 @@ Guild::GuildMap Guild::guilds; Guild::Guild(const int16_t id) : mMembers(), + mPositions(), mName(), + mEmblemId(0), mId(id), mCanInviteUsers(false), - mEmblemId(0), - mPositions(), mServerGuild(true) { guilds[id] = this; diff --git a/src/guild.h b/src/guild.h index 08b8b936e..50870288d 100644 --- a/src/guild.h +++ b/src/guild.h @@ -25,6 +25,8 @@ #include "avatar.h" +#include "guildpositionflags.h" + #include "gui/models/avatarlistmodel.h" #include "utils/dtor.h" @@ -210,11 +212,11 @@ class Guild final : public AvatarListModel explicit Guild(const int16_t id); MemberList mMembers; + PositionsMap mPositions; std::string mName; + int mEmblemId; int16_t mId; bool mCanInviteUsers; - int mEmblemId; - PositionsMap mPositions; bool mServerGuild; }; diff --git a/src/guildpositionflags.h b/src/guildpositionflags.h index b9964c5b3..7307c3444 100644 --- a/src/guildpositionflags.h +++ b/src/guildpositionflags.h @@ -29,8 +29,9 @@ namespace GuildPositionFlags { enum Type { + None = 0x00, Invite = 0x01, - Expel = 0x10 + Expel = 0x10 }; } diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index 03c5a34ef..2d23eaa16 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -355,12 +355,13 @@ void GuildHandler::checkMaster() const 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); + const int guildId = msg.readInt32("guild id"); + const int emblem = msg.readInt32("elblem id"); + PlayerInfo::setGuildPositionFlags( + static_cast<GuildPositionFlags::Type>(msg.readInt32("mode"))); + msg.readUInt8("guild master"); + msg.readInt32("unused"); + std::string guildName = msg.readString(24, "guild name"); Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId)); if (!g) @@ -385,9 +386,6 @@ void GuildHandler::processGuildPositionInfo(Net::MessageIn &msg) const localPlayer->setGuild(g); localPlayer->setGuildName(g->getName()); } - - logger->log("Guild position info: %d %d %d %s\n", guildId, - emblem, posMode, guildName.c_str()); } } // namespace EAthena diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 9445a4760..24bb06514 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -342,12 +342,14 @@ void GuildHandler::checkMaster() const 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); + const int guildId = msg.readInt32("guild id"); + const int emblem = msg.readInt32("emblem"); + const int posMode = msg.readInt32("position"); + msg.readInt32("unused"); + msg.readUInt8("usused"); + std::string guildName = msg.readString(24, "guild name"); + + PlayerInfo::setGuildPositionFlags(GuildPositionFlags::Invite); Guild *const g = Guild::getGuild(static_cast<int16_t>(guildId)); if (!g) |