diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 41688f8a2..4582a0159 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -822,17 +822,23 @@ void Guild::UpdateLogoutTime(uint64 guid) } /** - * Updates the number of accounts that are in the guild + * Return the number of accounts that are in the guild after possible update if required * A player may have many characters in the guild, but with the same account */ -void Guild::UpdateAccountsNumber() +uint32 Guild::GetAccountsNumber() { + // not need recalculation + if (m_accountsNumber) + return m_accountsNumber; + //We use a set to be sure each element will be unique std::set accountsIdSet; for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr) accountsIdSet.insert(itr->second.accountId); m_accountsNumber = accountsIdSet.size(); + + return m_accountsNumber; } // ************************************************* diff --git a/src/game/Guild.h b/src/game/Guild.h index 7979334d2..6c9e673e7 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -327,7 +327,7 @@ class Guild void SetEmblem(uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor); uint32 GetMemberSize() const { return members.size(); } - uint32 GetAccountsNumber() const { return m_accountsNumber; } + uint32 GetAccountsNumber(); bool LoadGuildFromDB(QueryResult *guildDataResult); bool CheckGuildStructure(); @@ -447,7 +447,7 @@ class Guild uint32 m_BorderStyle; uint32 m_BorderColor; uint32 m_BackgroundColor; - uint32 m_accountsNumber; + uint32 m_accountsNumber; // 0 used as marker for need lazy calculation at request RankList m_Ranks; @@ -470,7 +470,8 @@ class Guild uint64 m_GuildBankMoney; private: - void UpdateAccountsNumber(); + void UpdateAccountsNumber() { m_accountsNumber = 0;}// mark for lazy calculation at request in GetAccountsNumber + // used only from high level Swap/Move functions Item* GetItem(uint8 TabId, uint8 SlotId); uint8 CanStoreItem( uint8 tab, uint8 slot, GuildItemPosCountVec& dest, uint32 count, Item *pItem, bool swap = false) const; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a37a0a625..feb1fe611 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10284" + #define REVISION_NR "10285" #endif // __REVISION_NR_H__