diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-06-16 17:30:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-06-16 17:30:45 +0300 |
commit | c2aaab0b81248dea60472934c5be64c417376549 (patch) | |
tree | 62f45249705fdf870e1f9f88de102dd521199dae | |
parent | b5b386c2de8c9b988ed19c979f0d4b1d7fcfdbd4 (diff) | |
download | manaplus-c2aaab0b81248dea60472934c5be64c417376549.tar.gz manaplus-c2aaab0b81248dea60472934c5be64c417376549.tar.bz2 manaplus-c2aaab0b81248dea60472934c5be64c417376549.tar.xz manaplus-c2aaab0b81248dea60472934c5be64c417376549.zip |
Add team id into beings cache.
-rw-r--r-- | src/being/being.cpp | 4 | ||||
-rw-r--r-- | src/being/beingcacheentry.h | 8 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 08f055ed2..7f7c9fa65 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2367,6 +2367,7 @@ bool Being::updateFromCache() setLevel(entry->getLevel()); setPvpRank(entry->getPvpRank()); setIp(entry->getIp()); + setTeamId(entry->getTeamId()); mAdvanced = entry->isAdvanced(); if (mAdvanced) @@ -2388,7 +2389,7 @@ bool Being::updateFromCache() } updateAwayEffect(); - if (mType == ActorType::Player) + if (mType == ActorType::Player || mTeamId) updateColors(); return true; } @@ -2423,6 +2424,7 @@ void Being::addToCache() const entry->setPvpRank(getPvpRank()); entry->setIp(getIp()); entry->setAdvanced(isAdvanced()); + entry->setTeamId(getTeamId()); if (isAdvanced()) { int flags = 0; diff --git a/src/being/beingcacheentry.h b/src/being/beingcacheentry.h index 59b0054fe..c9ed59751 100644 --- a/src/being/beingcacheentry.h +++ b/src/being/beingcacheentry.h @@ -40,6 +40,7 @@ class BeingCacheEntry final mPvpRank(0), mTime(0), mFlags(0), + mTeamId(0U), mIsAdvanced(false) { } @@ -114,6 +115,12 @@ class BeingCacheEntry final void setFlags(const int flags) { mFlags = flags; } + uint16_t getTeamId() const + { return mTeamId; } + + void setTeamId(const uint16_t teamId) + { mTeamId = teamId; } + protected: std::string mName; /**< Name of character */ std::string mPartyName; @@ -124,6 +131,7 @@ class BeingCacheEntry final unsigned int mPvpRank; int mTime; int mFlags; + uint16_t mTeamId; bool mIsAdvanced; }; diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index e80dfd8a1..80fda81be 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -1625,6 +1625,7 @@ void BeingHandler::processPvpSet(Net::MessageIn &msg) { dstBeing->setPvpRank(rank); dstBeing->setTeamId(teamId); + dstBeing->addToCache(); } } BLOCK_END("BeingHandler::processPvpSet") |