[9282] Possible fixed crash source added in [9228]

After [9228] groups stored under leader guid keys, but group leader can change
and in result at group disband after leader change group not removed from storage.
This commit is contained in:
VladimirMangos 2010-02-02 00:43:18 +03:00
parent b85417df73
commit 742f8df025
3 changed files with 11 additions and 1 deletions

View file

@ -1253,6 +1253,11 @@ void Group::_setLeader(const uint64 &guid)
m_leaderGuid = slot->guid; m_leaderGuid = slot->guid;
m_leaderName = slot->name; m_leaderName = slot->name;
// Non-BG groups stored in sObjectMgr with leader low-guids as keys
if (IsCreated() && !isBGGroup())
sObjectMgr.UpdateGroup(this);
} }
void Group::_removeRolls(const uint64 &guid) void Group::_removeRolls(const uint64 &guid)

View file

@ -411,6 +411,11 @@ class ObjectMgr
Group * GetGroupByLeaderLowGUID(uint32 lowguid) const; Group * GetGroupByLeaderLowGUID(uint32 lowguid) const;
void AddGroup(Group* group); void AddGroup(Group* group);
void RemoveGroup(Group* group); void RemoveGroup(Group* group);
void UpdateGroup(Group* group) // when need update leader guid as group key
{
RemoveGroup(group);
AddGroup(group);
}
Guild* GetGuildByLeader(uint64 const&guid) const; Guild* GetGuildByLeader(uint64 const&guid) const;
Guild* GetGuildById(uint32 GuildId) const; Guild* GetGuildById(uint32 GuildId) const;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9281" #define REVISION_NR "9282"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__