mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
call OnObjectDBLoad(Creature/GameObject) for battleground at object-loading
this is a virtual function and can be used to move gameobjects and creatures from battlegroundcode to database for this i also had to add a BattleGround-pointer to the map so i renamed CreateBattleGround(instanceid) to CreateBattleGroundMap(instanceid, Battleground*)
This commit is contained in:
parent
1665077dc4
commit
bd87209498
5 changed files with 17 additions and 5 deletions
|
|
@ -109,6 +109,8 @@ template<> void addUnitState(Creature *obj, CellPair const& cell_pair)
|
|||
template <class T>
|
||||
void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &m, uint32 &count, Map* map)
|
||||
{
|
||||
BattleGround* bg = map->IsBattleGroundOrArena() ? ((BattleGroundMap*)map)->GetBG() : NULL;
|
||||
|
||||
for(CellGuidSet::const_iterator i_guid = guid_set.begin(); i_guid != guid_set.end(); ++i_guid)
|
||||
{
|
||||
T* obj = new T;
|
||||
|
|
@ -127,9 +129,10 @@ void LoadHelper(CellGuidSet const& guid_set, CellPair &cell, GridRefManager<T> &
|
|||
obj->AddToWorld();
|
||||
if(obj->isActiveObject())
|
||||
map->AddToActive(obj);
|
||||
if (bg)
|
||||
bg->OnObjectDBLoad(obj);
|
||||
|
||||
++count;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue