[9597] create battleground map at bg creation

when a bg gets created it will also get it's map
(old behaviour was, that map got's created when first player entered the instance)

the reason why battlegroundmaps aren't instantiated with a player object:
    * the only information from player-class we need is player->GetBattleGround()
      also we can't use anything else
      (e.g. playerlevel can be outside of bg-levelrange)
      -> cause bgs depend pretty much on their maps this caused circualr dependencies between map,bg,player
    * battlegroundmaps will _always_ be prepared by the bgsystem to set the proper data
    * there is not much shared in the creational process with dungeonmaps
      even the functioncall is different since players need to enqueue first for bgs,
      therefore again the player's way to that instance is only through the bgMgr
This commit is contained in:
balrok 2010-03-16 13:53:20 +01:00
parent db51c29235
commit 24d45c6a08
8 changed files with 24 additions and 21 deletions

View file

@ -104,11 +104,8 @@ void MapInstanced::UnloadAll(bool pForce)
Map::UnloadAll(pForce);
}
/*
- return the right instance for the object, based on its InstanceId
- create the instance if it's not created already
- the player is not actually added to the instance (only in InstanceMap::Add)
*/
/// returns a new or existing Instance
/// in case of battlegrounds it will only return an existing map, those maps are created by bg-system
Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
{
if(GetId() != mapId || !player)
@ -119,13 +116,11 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player * player)
if(IsBattleGroundOrArena())
{
// instantiate or find existing bg map for player
// the instance id is set in battlegroundid
// find existing bg map for player
NewInstanceId = player->GetBattleGroundId();
ASSERT(NewInstanceId);
map = _FindMap(NewInstanceId);
if(!map)
map = CreateBattleGroundMap(NewInstanceId, player->GetBattleGround());
ASSERT(map);
}
else
{