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:
balrok 2008-12-06 18:52:47 +01:00 committed by balrok
parent 1665077dc4
commit bd87209498
5 changed files with 17 additions and 5 deletions

View file

@ -135,7 +135,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
ASSERT(NewInstanceId);
map = _FindMap(NewInstanceId);
if(!map)
map = CreateBattleGround(NewInstanceId);
map = CreateBattleGroundMap(NewInstanceId, player->GetBattleGround());
}
else
{
@ -208,15 +208,16 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save,
return map;
}
BattleGroundMap* MapInstanced::CreateBattleGround(uint32 InstanceId)
BattleGroundMap* MapInstanced::CreateBattleGroundMap(uint32 InstanceId, BattleGround* bg)
{
// load/create a map
Guard guard(*this);
sLog.outDebug("MapInstanced::CreateBattleGround: map bg %d for %d created.", InstanceId, GetId());
sLog.outDebug("MapInstanced::CreateBattleGroundMap: instance:%d for map:%d and bgType:%d created.", InstanceId, GetId(), bg->GetTypeID());
BattleGroundMap *map = new BattleGroundMap(GetId(), GetGridExpiry(), InstanceId, this);
ASSERT(map->IsBattleGroundOrArena());
map->SetBG(bg);
m_InstancedMaps[InstanceId] = map;
return map;