diff options
author | Andrei Karas <akaras@inbox.ru> | 2018-02-13 20:17:00 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2018-02-13 20:17:00 +0300 |
commit | 69238eddfc6374ad54a63f14fd29fd7b4dfbba48 (patch) | |
tree | 49929dd811a18050b4322bc32f37185e95b5666d | |
parent | 201b3842582979ec23f611e8cf7bc0f433ac44e5 (diff) | |
download | plus-69238eddfc6374ad54a63f14fd29fd7b4dfbba48.tar.gz plus-69238eddfc6374ad54a63f14fd29fd7b4dfbba48.tar.bz2 plus-69238eddfc6374ad54a63f14fd29fd7b4dfbba48.tar.xz plus-69238eddfc6374ad54a63f14fd29fd7b4dfbba48.zip |
Store clan names into each player being.
-rw-r--r-- | src/net/eathena/beingrecv.cpp | 18 | ||||
-rw-r--r-- | src/resources/claninfo.h | 2 | ||||
-rw-r--r-- | src/resources/db/clandb.cpp | 4 |
3 files changed, 24 insertions, 0 deletions
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp index f2b02b05c..313c2872b 100644 --- a/src/net/eathena/beingrecv.cpp +++ b/src/net/eathena/beingrecv.cpp @@ -56,7 +56,10 @@ #include "net/eathena/sp.h" #include "net/eathena/sprite.h" +#include "resources/claninfo.h" #include "resources/iteminfo.h" + +#include "resources/db/clandb.h" #include "resources/db/itemdb.h" #include "resources/map/map.h" @@ -1771,6 +1774,9 @@ void BeingRecv::processBeingAttrs(Net::MessageIn &msg) int language = -1; if (serverVersion >= 17 && len > 14) language = msg.readInt16("language"); + int clanId = 0; + if (len > 16) + clanId = msg.readInt32("clan id"); if (dstBeing != nullptr) { if (serverVersion <= 17 || @@ -1784,6 +1790,18 @@ void BeingRecv::processBeingAttrs(Net::MessageIn &msg) } dstBeing->setHorse(mount); dstBeing->setLanguageId(language); + if (clanId != 0) + { + const ClanInfo *const info = ClanDb::get(clanId); + if (info == nullptr) + dstBeing->setClanName(std::string()); + else + dstBeing->setClanName(info->name); + } + else + { + dstBeing->setClanName(std::string()); + } if (dstBeing == localPlayer) PlayerInfo::setServerLanguage(language); } diff --git a/src/resources/claninfo.h b/src/resources/claninfo.h index fd96ecf51..2e85eed15 100644 --- a/src/resources/claninfo.h +++ b/src/resources/claninfo.h @@ -31,12 +31,14 @@ struct ClanInfo final { ClanInfo() : stats(), + name(), id(0) { } A_DELETE_COPY(ClanInfo) STD_VECTOR<std::string> stats; + std::string name; int id; }; diff --git a/src/resources/db/clandb.cpp b/src/resources/db/clandb.cpp index e4cf691dd..c613067e3 100644 --- a/src/resources/db/clandb.cpp +++ b/src/resources/db/clandb.cpp @@ -31,6 +31,7 @@ #include "utils/checkutils.h" #include "utils/dtor.h" +#include "utils/gettext.h" #include "utils/itemxmlutils.h" #include "debug.h" @@ -96,6 +97,9 @@ void ClanDb::loadXmlFile(const std::string &fileName, clanInfo = new ClanInfo; clanInfo->id = id; + clanInfo->name = XML::langProperty( + // TRANSLATORS: unknown clan name + clanNode, "name", _("unnamed")); readItemStatsVector(clanInfo->stats, clanNode, |