Clean up very some confusing MapManager functions (create/find map/base map).

This commit is contained in:
megamage
2011-11-23 12:45:59 -05:00
parent b3fef1e280
commit 98be413ce0
6 changed files with 25 additions and 30 deletions
+5 -5
View File
@@ -940,7 +940,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
return false;
}
SetMap(sMapMgr->CreateMap(info->mapId, this, 0));
SetMap(sMapMgr->CreateMap(info->mapId, this));
uint8 powertype = cEntry->powerType;
@@ -2205,7 +2205,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
if (!sMapMgr->CanPlayerEnter(mapid, this, false))
return false;
Map* map = sMapMgr->CreateMap(mapid, this, 0);
Map* map = sMapMgr->CreateMap(mapid, this);
if (!map || map->CanEnter(this))
{
//lets reset near teleport flag if it wasn't reset during chained teleports
@@ -16790,7 +16790,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
// NOW player must have valid map
// load the player's map here if it's not already loaded
Map* map = sMapMgr->CreateMap(mapId, this, instanceId);
Map* map = sMapMgr->CreateMap(mapId, this);
if (!map)
{
@@ -16808,14 +16808,14 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
RelocateToHomebind();
}
map = sMapMgr->CreateMap(mapId, this, 0);
map = sMapMgr->CreateMap(mapId, this);
if (!map)
{
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass());
mapId = info->mapId;
Relocate(info->positionX, info->positionY, info->positionZ, 0.0f);
sLog->outError("Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
map = sMapMgr->CreateMap(mapId, this, 0);
map = sMapMgr->CreateMap(mapId, this);
if (!map)
{
sLog->outError("Player (guidlow %d) has invalid default map coordinates (X: %f Y: %f Z: %f O: %f). or instance couldn't be created", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
@@ -98,7 +98,7 @@ void MapManager::LoadTransports()
m_TransportsByMap[*i].insert(t);
//If we someday decide to use the grid to track transports, here:
t->SetMap(sMapMgr->CreateMap(mapid, t, 0));
t->SetMap(sMapMgr->CreateBaseMap(mapid));
t->AddToWorld();
++count;
@@ -494,7 +494,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
RemoveFromWorld();
ResetMap();
Map* newMap = sMapMgr->CreateMap(newMapid, this, 0);
Map* newMap = sMapMgr->CreateBaseMap(newMapid);
SetMap(newMap);
ASSERT (GetMap());
AddToWorld();