diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 75b85047a..7dc621ef9 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -641,7 +641,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) pCurrChar->SetRank(0); } - if (!MapManager::Instance().GetMap(pCurrChar->GetMapId(), pCurrChar)->Add(pCurrChar)) + if (!pCurrChar->GetMap()->Add(pCurrChar)) { AreaTrigger const* at = objmgr.GetGoBackTrigger(pCurrChar->GetMapId()); if(at) diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 10baaeae3..e820c7b57 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -1174,7 +1174,7 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid TypeContainerVisitor, GridTypeMapContainer > object_checker(checker); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(pl->GetMapId(), pl)); + cell_lock->Visit(cell_lock, object_checker, *pl->GetMap()); } return obj; diff --git a/src/game/Creature.cpp b/src/game/Creature.cpp index 9a3f9bed0..50bbdc146 100644 --- a/src/game/Creature.cpp +++ b/src/game/Creature.cpp @@ -149,7 +149,7 @@ void Creature::RemoveCorpse() float x,y,z,o; GetRespawnCoord(x, y, z, &o); - MapManager::Instance().GetMap(GetMapId(), this)->CreatureRelocation(this,x,y,z,o); + GetMap()->CreatureRelocation(this,x,y,z,o); } /** @@ -337,7 +337,7 @@ void Creature::Update(uint32 diff) //Call AI respawn virtual function i_AI->JustRespawned(); - MapManager::Instance().GetMap(GetMapId(), this)->Add(this); + GetMap()->Add(this); } break; } @@ -1681,7 +1681,7 @@ void Creature::CallAssistence() TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(searcher); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, grid_creature_searcher, *MapManager::Instance().GetMap(GetMapId(), this)); + cell_lock->Visit(cell_lock, grid_creature_searcher, *GetMap()); } for(std::list::iterator iter = assistList.begin(); iter != assistList.end(); ++iter) diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index 970209d7a..21c689e57 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -122,8 +122,8 @@ void DynamicObject::Update(uint32 p_time) TypeContainerVisitor grid_object_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(GetMapId(), this)); - cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(GetMapId(), this)); + cell_lock->Visit(cell_lock, world_object_notifier, *GetMap()); + cell_lock->Visit(cell_lock, grid_object_notifier, *GetMap()); if(deleteThis) { diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index a232afdcb..866157571 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -274,7 +274,7 @@ void GameObject::Update(uint32 /*p_time*/) return; } // respawn timer - MapManager::Instance().GetMap(GetMapId(), this)->Add(this); + GetMap()->Add(this); break; } } @@ -325,13 +325,13 @@ void GameObject::Update(uint32 /*p_time*/) CellLock cell_lock(cell, p); TypeContainerVisitor, GridTypeMapContainer > grid_object_checker(checker); - cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); + cell_lock->Visit(cell_lock, grid_object_checker, *GetMap()); // or unfriendly player/pet if(!ok) { TypeContainerVisitor, WorldTypeMapContainer > world_object_checker(checker); - cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); + cell_lock->Visit(cell_lock, world_object_checker, *GetMap()); } } else // environmental trap @@ -346,7 +346,7 @@ void GameObject::Update(uint32 /*p_time*/) CellLock cell_lock(cell, p); TypeContainerVisitor, WorldTypeMapContainer > world_object_checker(checker); - cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); + cell_lock->Visit(cell_lock, world_object_checker, *GetMap()); ok = p_ok; } @@ -460,7 +460,7 @@ void GameObject::Refresh() return; if(isSpawned()) - MapManager::Instance().GetMap(GetMapId(), this)->Add(this); + GetMap()->Add(this); } void GameObject::AddUniqueUse(Player* player) @@ -803,7 +803,7 @@ void GameObject::TriggeringLinkedGameObject( uint32 trapEntry, Unit* target) TypeContainerVisitor, GridTypeMapContainer > object_checker(checker); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); + cell_lock->Visit(cell_lock, object_checker, *GetMap()); } // found correct GO @@ -825,7 +825,7 @@ GameObject* GameObject::LookupFishingHoleAround(float range) CellLock cell_lock(cell, p); TypeContainerVisitor, GridTypeMapContainer > grid_object_checker(checker); - cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(GetMapId(), this)); + cell_lock->Visit(cell_lock, grid_object_checker, *GetMap()); return ok; } diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 3bb2475cd..5730ad1d6 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -288,7 +288,7 @@ bool ChatHandler::HandleGPSCommand(const char* args) Map2ZoneCoordinates(zone_x,zone_y,zone_id); - Map const *map = MapManager::Instance().GetMap(obj->GetMapId(), obj); + Map const *map = obj->GetMap(); float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT); float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()); @@ -349,11 +349,11 @@ bool ChatHandler::HandleNamegoCommand(const char* args) return false; } - Map* pMap = MapManager::Instance().GetMap(m_session->GetPlayer()->GetMapId(),m_session->GetPlayer()); + Map* pMap = m_session->GetPlayer()->GetMap(); if(pMap->Instanceable()) { - Map* cMap = MapManager::Instance().GetMap(chr->GetMapId(),chr); + Map* cMap = chr->GetMap(); if( cMap->Instanceable() && cMap->GetInstanceId() != pMap->GetInstanceId() ) { // cannot summon from instance to instance @@ -435,7 +435,7 @@ bool ChatHandler::HandleGonameCommand(const char* args) Player *chr = objmgr.GetPlayer(name.c_str()); if (chr) { - Map* cMap = MapManager::Instance().GetMap(chr->GetMapId(),chr); + Map* cMap = chr->GetMap(); if(cMap->Instanceable()) { // we have to go to instance, and can go to player only if: @@ -2058,7 +2058,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args) return false; } - Map* gmMap = MapManager::Instance().GetMap(m_session->GetPlayer()->GetMapId(),m_session->GetPlayer()); + Map* gmMap = m_session->GetPlayer()->GetMap(); bool to_instance = gmMap->Instanceable(); // we are in instance, and can summon only player in our group with us as lead @@ -2088,7 +2088,7 @@ bool ChatHandler::HandleGroupgoCommand(const char* args) if (to_instance) { - Map* plMap = MapManager::Instance().GetMap(pl->GetMapId(),pl); + Map* plMap = pl->GetMap(); if ( plMap->Instanceable() && plMap->GetInstanceId() != gmMap->GetInstanceId() ) { diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index b86d648f8..390c68389 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1056,7 +1056,7 @@ bool ChatHandler::HandleTurnObjectCommand(const char* args) float rot2 = sin(o/2); float rot3 = cos(o/2); - Map* map = MapManager::Instance().GetMap(obj->GetMapId(),obj); + Map* map = obj->GetMap(); map->Remove(obj,false); obj->Relocate(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), o); @@ -1140,7 +1140,7 @@ bool ChatHandler::HandleNpcMoveCommand(const char* args) const_cast(data)->posZ = z; const_cast(data)->orientation = o; } - MapManager::Instance().GetMap(pCreature->GetMapId(),pCreature)->CreatureRelocation(pCreature,x, y, z,o); + pCreature->GetMap()->CreatureRelocation(pCreature,x, y, z,o); pCreature->GetMotionMaster()->Initialize(); if(pCreature->isAlive()) // dead creature will reset movement generator at respawn { @@ -1187,7 +1187,7 @@ bool ChatHandler::HandleMoveObjectCommand(const char* args) { Player *chr = m_session->GetPlayer(); - Map* map = MapManager::Instance().GetMap(obj->GetMapId(),obj); + Map* map = obj->GetMap(); map->Remove(obj,false); obj->Relocate(chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ(), obj->GetOrientation()); @@ -1213,7 +1213,7 @@ bool ChatHandler::HandleMoveObjectCommand(const char* args) return false; } - Map* map = MapManager::Instance().GetMap(obj->GetMapId(),obj); + Map* map = obj->GetMap(); map->Remove(obj,false); obj->Relocate(x, y, z, obj->GetOrientation()); @@ -2675,7 +2675,7 @@ bool ChatHandler::HandleWpModifyCommand(const char* args) // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); wpCreature2->LoadFromDB(wpCreature2->GetDBTableGUIDLow(), map); map->Add(wpCreature2); - //MapManager::Instance().GetMap(npcCreature->GetMapId())->Add(wpCreature2); + //npcCreature->GetMap()->Add(wpCreature2); } WaypointMgr.SetNodePosition(lowguid, point, chr->GetPositionX(), chr->GetPositionY(), chr->GetPositionZ()); @@ -2985,7 +2985,7 @@ bool ChatHandler::HandleWpShowCommand(const char* args) // To call _LoadGoods(); _LoadQuests(); CreateTrainerSpells(); wpCreature->LoadFromDB(wpCreature->GetDBTableGUIDLow(),map); map->Add(wpCreature); - //MapManager::Instance().GetMap(wpCreature->GetMapId())->Add(wpCreature); + //wpCreature->GetMap()->Add(wpCreature); }while( result->NextRow() ); // Cleanup memory @@ -4167,7 +4167,7 @@ bool ChatHandler::HandleNpcTameCommand(const char* /*args*/) pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1); // add to world - MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet); + pet->GetMap()->Add((Creature*)pet); // visual effect for levelup pet->SetUInt32Value(UNIT_FIELD_LEVEL, level); diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index bf9cbbc9d..bb7c44d1b 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -5415,7 +5415,7 @@ bool ChatHandler::HandleRespawnCommand(const char* /*args*/) TypeContainerVisitor, GridTypeMapContainer > obj_worker(worker); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, obj_worker, *MapManager::Instance().GetMap(pl->GetMapId(), pl)); + cell_lock->Visit(cell_lock, obj_worker, *pl->GetMap()); return true; } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index ee14fe886..f60395953 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -1783,9 +1783,9 @@ void InstanceMap::UnloadAll(bool pForce) Map::UnloadAll(pForce); } -void InstanceMap::SendResetWarnings(uint32 timeLeft) +void InstanceMap::SendResetWarnings(uint32 timeLeft) const { - for(MapRefManager::iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) + for(MapRefManager::const_iterator itr = m_mapRefManager.begin(); itr != m_mapRefManager.end(); ++itr) itr->getSource()->SendInstanceResetWarning(GetId(), timeLeft); } diff --git a/src/game/Map.h b/src/game/Map.h index 96b3cfcb3..3657f6221 100644 --- a/src/game/Map.h +++ b/src/game/Map.h @@ -125,6 +125,7 @@ typedef UNORDERED_MAP CreatureMoveList; class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::ObjectLevelLockable { + friend class MapReference; public: Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); virtual ~Map(); @@ -251,8 +252,8 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj void SendToPlayers(WorldPacket const* data) const; - MapRefManager m_mapRefManager; - + typedef MapRefManager PlayerList; + PlayerList const& GetPlayers() const { return m_mapRefManager; } private: void LoadVMap(int pX, int pY); void LoadMap(uint32 mapid, uint32 instanceid, int x,int y); @@ -301,6 +302,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager, public MaNGOS::Obj uint32 i_InstanceId; uint32 m_unloadTimer; + MapRefManager m_mapRefManager; private: typedef GridReadGuard ReadGuard; typedef GridWriteGuard WriteGuard; @@ -340,8 +342,6 @@ enum InstanceResetMethod class MANGOS_DLL_SPEC InstanceMap : public Map { public: - typedef std::list PlayerList; // online players only - InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode); ~InstanceMap(); bool Add(Player *); @@ -355,7 +355,7 @@ class MANGOS_DLL_SPEC InstanceMap : public Map time_t GetResetTime(); void UnloadAll(bool pForce); bool CanEnter(Player* player); - void SendResetWarnings(uint32 timeLeft); + void SendResetWarnings(uint32 timeLeft) const; void SetResetSchedule(bool on); private: bool m_resetAfterUnload; diff --git a/src/game/MapManager.cpp b/src/game/MapManager.cpp index 2b6d278bc..626087397 100644 --- a/src/game/MapManager.cpp +++ b/src/game/MapManager.cpp @@ -337,7 +337,7 @@ uint32 MapManager::GetNumPlayersInInstances() MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps(); for(MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr) if(mitr->second->IsDungeon()) - ret += ((InstanceMap*)mitr->second)->m_mapRefManager.getSize(); + ret += ((InstanceMap*)mitr->second)->GetPlayers().getSize(); } return ret; } diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 8f74cdddd..9ef0b6649 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -72,7 +72,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SendInitialPacketsBeforeAddToMap(); // the CanEnter checks are done in TeleporTo but conditions may change // while the player is in transit, for example the map may get full - if(!MapManager::Instance().GetMap(GetPlayer()->GetMapId(), GetPlayer())->Add(GetPlayer())) + if(!GetPlayer()->GetMap()->Add(GetPlayer())) { sLog.outDebug("WORLD: teleport of player %s (%d) to location %d,%f,%f,%f,%f failed", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.x, loc.y, loc.z, loc.o); // teleport the player home diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 42b5833ba..8af7dbe5c 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1054,7 +1054,7 @@ uint32 WorldObject::GetAreaId() const InstanceData* WorldObject::GetInstanceData() { - Map *map = MapManager::Instance().GetMap(m_mapId, this); + Map *map = GetMap(); return map->IsDungeon() ? ((InstanceMap*)map)->GetInstanceData() : NULL; } @@ -1425,12 +1425,12 @@ void WorldObject::BuildTeleportAckMsg(WorldPacket *data, float x, float y, float void WorldObject::SendMessageToSet(WorldPacket *data, bool /*bToSelf*/) { - MapManager::Instance().GetMap(m_mapId, this)->MessageBroadcast(this, data); + GetMap()->MessageBroadcast(this, data); } void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*bToSelf*/) { - MapManager::Instance().GetMap(m_mapId, this)->MessageDistBroadcast(this, data, dist); + GetMap()->MessageDistBroadcast(this, data, dist); } void WorldObject::SendObjectDeSpawnAnim(uint64 guid) @@ -1619,8 +1619,8 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float &x, float &y, TypeContainerVisitor, WorldTypeMapContainer > world_obj_worker(worker); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, grid_obj_worker, *MapManager::Instance().GetMap(GetMapId(), this)); - cell_lock->Visit(cell_lock, world_obj_worker, *MapManager::Instance().GetMap(GetMapId(), this)); + cell_lock->Visit(cell_lock, grid_obj_worker, *GetMap()); + cell_lock->Visit(cell_lock, world_obj_worker, *GetMap()); } // maybe can just place in primary position diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 94897d997..a1305e7f7 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -142,7 +142,15 @@ Creature* ObjectAccessor::GetCreature(WorldObject const &u, uint64 guid) { Creature * ret = GetObjectInWorld(guid, (Creature*)NULL); - if(ret && ret->GetMapId() != u.GetMapId()) ret = NULL; + if(!ret) + return NULL; + + if(ret->GetMapId() != u.GetMapId()) + return NULL; + + if(ret->GetInstanceId() != u.GetInstanceId()) + return NULL; + return ret; } @@ -335,7 +343,7 @@ ObjectAccessor::_buildChangeObjectForPlayer(WorldObject *obj, UpdateDataMapType WorldObjectChangeAccumulator notifier(*obj, update_players); TypeContainerVisitor player_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, player_notifier, *MapManager::Instance().GetMap(obj->GetMapId(), obj)); + cell_lock->Visit(cell_lock, player_notifier, *obj->GetMap()); } Pet* @@ -533,14 +541,14 @@ ObjectAccessor::UpdateObjectVisibility(WorldObject *obj) CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); Cell cell(p); - MapManager::Instance().GetMap(obj->GetMapId(), obj)->UpdateObjectVisibility(obj,cell,p); + obj->GetMap()->UpdateObjectVisibility(obj,cell,p); } void ObjectAccessor::UpdateVisibilityForPlayer( Player* player ) { CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); Cell cell(p); - Map* m = MapManager::Instance().GetMap(player->GetMapId(),player); + Map* m = player->GetMap(); m->UpdatePlayerVisibility(player,cell,p); m->UpdateObjectsVisibilityFor(player,cell,p); diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index a00642432..0e1731e24 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -68,7 +68,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m) if(cur_cell.DiffGrid(resp_cell)) { - MapManager::Instance().GetMap(c->GetMapId(), c)->CreatureRespawnRelocation(c); + c->GetMap()->CreatureRespawnRelocation(c); // false result ignored: will be unload with other creatures at grid } } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 7f6dca38c..c6b6e8208 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1578,7 +1578,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati else { // far teleport to another map - Map* oldmap = IsInWorld() ? MapManager::Instance().GetMap(GetMapId(), this) : NULL; + Map* oldmap = IsInWorld() ? GetMap() : NULL; // check if we can enter before stopping combat / removing pet / totems / interrupting spells // Check enter rights before map getting to avoid creating instance copy for player @@ -5172,7 +5172,7 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele return false; } - Map *m = MapManager::Instance().GetMap(GetMapId(), this); + Map *m = GetMap(); const float old_x = GetPositionX(); const float old_y = GetPositionY(); @@ -5190,7 +5190,7 @@ bool Player::SetPosition(float x, float y, float z, float orientation, bool tele m->PlayerRelocation(this, x, y, z, orientation); // reread after Map::Relocation - m = MapManager::Instance().GetMap(GetMapId(), this); + m = GetMap(); x = GetPositionX(); y = GetPositionY(); z = GetPositionZ(); @@ -5219,17 +5219,17 @@ void Player::SaveRecallPosition() void Player::SendMessageToSet(WorldPacket *data, bool self) { - MapManager::Instance().GetMap(GetMapId(), this)->MessageBroadcast(this, data, self); + GetMap()->MessageBroadcast(this, data, self); } void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self) { - MapManager::Instance().GetMap(GetMapId(), this)->MessageDistBroadcast(this, data, dist, self); + GetMap()->MessageDistBroadcast(this, data, dist, self); } void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only) { - MapManager::Instance().GetMap(GetMapId(), this)->MessageDistBroadcast(this, data, dist, self,own_team_only); + GetMap()->MessageDistBroadcast(this, data, dist, self,own_team_only); } void Player::SendDirectMessage(WorldPacket *data) @@ -16444,8 +16444,8 @@ void Player::HandleStealthedUnitsDetection() TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this)); - cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this)); + cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap()); + cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap()); for (std::list::iterator i = stealthedUnits.begin(); i != stealthedUnits.end();) { diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 1318d8293..8a3f66f8a 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -477,12 +477,12 @@ void Spell::FillTargetMap() TypeContainerVisitor, GridTypeMapContainer > grid_searcher(searcher); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, grid_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, grid_searcher, *m_caster->GetMap()); if(!result) { TypeContainerVisitor, WorldTypeMapContainer > world_searcher(searcher); - cell_lock->Visit(cell_lock, world_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_searcher, *m_caster->GetMap()); } if(result) @@ -1222,8 +1222,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_unit_searcher, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap()); } if(tempUnitMap.empty()) @@ -1321,8 +1321,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_unit_searcher, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_unit_searcher, *m_caster->GetMap()); } tempUnitMap.sort(TargetDistanceOrder(pUnitTarget)); @@ -1379,8 +1379,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor grid_object_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap()); // exclude caster (this can be important if this not original caster) TagUnitMap.remove(m_caster); @@ -1462,8 +1462,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor grid_object_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap()); }break; case TARGET_ALL_FRIENDLY_UNITS_AROUND_CASTER: { @@ -1478,8 +1478,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor grid_object_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap()); }break; case TARGET_ALL_FRIENDLY_UNITS_IN_AREA: { @@ -1494,8 +1494,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor grid_object_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap()); }break; // TARGET_SINGLE_PARTY means that the spells can only be casted on a party member and not on the caster (some seals, fire shield from imp, etc..) case TARGET_SINGLE_PARTY: @@ -1571,8 +1571,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor grid_object_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap()); }break; case TARGET_DUELVSPLAYER: { @@ -1621,8 +1621,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor grid_object_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap()); } }break; case TARGET_MINION: @@ -1740,8 +1740,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor grid_object_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_object_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_object_notifier, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_object_notifier, *m_caster->GetMap()); } @@ -1805,8 +1805,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor world_notifier(notifier); TypeContainerVisitor grid_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_notifier, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_notifier, *m_caster->GetMap()); } } }break; @@ -1862,8 +1862,8 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list &TagUnitMap) TypeContainerVisitor grid_notifier(notifier); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); - cell_lock->Visit(cell_lock, grid_notifier, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, world_notifier, *m_caster->GetMap()); + cell_lock->Visit(cell_lock, grid_notifier, *m_caster->GetMap()); } } else @@ -3461,7 +3461,7 @@ uint8 Spell::CanCast(bool strict) TypeContainerVisitor, GridTypeMapContainer > object_checker(checker); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, object_checker, *m_caster->GetMap()); if(p_GameObject) { @@ -3500,7 +3500,7 @@ uint8 Spell::CanCast(bool strict) TypeContainerVisitor, GridTypeMapContainer > grid_creature_searcher(searcher); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, grid_creature_searcher, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, grid_creature_searcher, *m_caster->GetMap()); if(p_Creature ) { @@ -4518,7 +4518,7 @@ uint8 Spell::CheckItems() TypeContainerVisitor, GridTypeMapContainer > object_checker(checker); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)); + cell_lock->Visit(cell_lock, object_checker, *m_caster->GetMap()); if(!ok) return (uint8)SPELL_FAILED_REQUIRES_SPELL_FOCUS; diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index b09fd94e4..344ce5afb 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -733,8 +733,8 @@ void AreaAura::Update(uint32 diff) TypeContainerVisitor, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster)); - cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster)); + cell_lock->Visit(cell_lock, world_unit_searcher, *caster->GetMap()); + cell_lock->Visit(cell_lock, grid_unit_searcher, *caster->GetMap()); break; } case AREA_AURA_ENEMY: @@ -749,8 +749,8 @@ void AreaAura::Update(uint32 diff) TypeContainerVisitor, WorldTypeMapContainer > world_unit_searcher(searcher); TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster)); - cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(caster->GetMapId(), caster)); + cell_lock->Visit(cell_lock, world_unit_searcher, *caster->GetMap()); + cell_lock->Visit(cell_lock, grid_unit_searcher, *caster->GetMap()); break; } case AREA_AURA_OWNER: diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index f1a12dbb2..bcb802b83 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1944,7 +1944,7 @@ void Spell::EffectTeleportUnits(uint32 i) ((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); else { - MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation); + m_caster->GetMap()->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation); WorldPacket data; unitTarget->BuildTeleportAckMsg(&data, x, y, z, orientation); unitTarget->SendMessageToSet(&data, false); @@ -1970,7 +1970,7 @@ void Spell::EffectTeleportUnits(uint32 i) ((Player*)unitTarget)->TeleportTo(mapid, x, y, z, orientation, TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); else { - MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation); + m_caster->GetMap()->CreatureRelocation((Creature*)unitTarget, x, y, z, orientation); WorldPacket data; unitTarget->BuildTeleportAckMsg(&data, x, y, z, orientation); unitTarget->SendMessageToSet(&data, false); @@ -2632,7 +2632,7 @@ void Spell::EffectPersistentAA(uint32 i) dynObj->SetUInt32Value(GAMEOBJECT_DISPLAYID, 368003); dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x01eeeeee); m_caster->AddDynObject(dynObj); - MapManager::Instance().GetMap(dynObj->GetMapId(), dynObj)->Add(dynObj); + dynObj->GetMap()->Add(dynObj); } void Spell::EffectEnergize(uint32 i) @@ -3473,7 +3473,7 @@ void Spell::EffectAddFarsight(uint32 i) dynObj->SetUInt32Value(OBJECT_FIELD_TYPE, 65); dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002); m_caster->AddDynObject(dynObj); - MapManager::Instance().GetMap(dynObj->GetMapId(), dynObj)->Add(dynObj); + dynObj->GetMap()->Add(dynObj); if(m_caster->GetTypeId() == TYPEID_PLAYER) ((Player*)m_caster)->SetFarSight(dynObj->GetGUID()); } @@ -3671,7 +3671,7 @@ void Spell::EffectTeleUnitsFaceCaster(uint32 i) if(unitTarget->GetTypeId() == TYPEID_PLAYER) ((Player*)unitTarget)->TeleportTo(mapid, fx, fy, fz, -m_caster->GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); else - MapManager::Instance().GetMap(mapid, m_caster)->CreatureRelocation((Creature*)m_caster, fx, fy, fz, -m_caster->GetOrientation()); + m_caster->GetMap()->CreatureRelocation((Creature*)m_caster, fx, fy, fz, -m_caster->GetOrientation()); } void Spell::EffectLearnSkill(uint32 i) @@ -3914,7 +3914,7 @@ void Spell::EffectTameCreature(uint32 /*i*/) pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1); // add to world - MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet); + pet->GetMap()->Add((Creature*)pet); // visual effect for levelup pet->SetUInt32Value(UNIT_FIELD_LEVEL, level); @@ -3944,14 +3944,14 @@ void Spell::EffectSummonPet(uint32 i) if( OldSummon->isDead() ) return; - MapManager::Instance().GetMap(OldSummon->GetMapId(), OldSummon)->Remove((Creature*)OldSummon,false); + OldSummon->GetMap()->Remove((Creature*)OldSummon,false); OldSummon->SetMapId(m_caster->GetMapId()); float px, py, pz; m_caster->GetClosePoint(px, py, pz, OldSummon->GetObjectSize()); OldSummon->Relocate(px, py, pz, OldSummon->GetOrientation()); - MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)->Add((Creature*)OldSummon); + m_caster->GetMap()->Add((Creature*)OldSummon); if(m_caster->GetTypeId() == TYPEID_PLAYER && OldSummon->isControlled() ) { @@ -5485,7 +5485,7 @@ void Spell::EffectMomentMove(uint32 i) if(unitTarget->GetTypeId() == TYPEID_PLAYER) ((Player*)unitTarget)->TeleportTo(mapid, fx, fy, fz, unitTarget->GetOrientation(), TELE_TO_NOT_LEAVE_COMBAT | TELE_TO_NOT_UNSUMMON_PET | (unitTarget==m_caster ? TELE_TO_SPELL : 0)); else - MapManager::Instance().GetMap(mapid, unitTarget)->CreatureRelocation((Creature*)unitTarget, fx, fy, fz, unitTarget->GetOrientation()); + m_caster->GetMap()->CreatureRelocation((Creature*)unitTarget, fx, fy, fz, unitTarget->GetOrientation()); } } @@ -5595,7 +5595,7 @@ void Spell::EffectCharge(uint32 /*i*/) m_caster->SendMonsterMove(x, y, z, 0, MOVEMENTFLAG_WALK_MODE, 1); if(m_caster->GetTypeId() != TYPEID_PLAYER) - MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)->CreatureRelocation((Creature*)m_caster,x,y,z,m_caster->GetOrientation()); + m_caster->GetMap()->CreatureRelocation((Creature*)m_caster,x,y,z,m_caster->GetOrientation()); // not all charge effects used in negative spells if ( !IsPositiveSpell(m_spellInfo->Id)) @@ -6031,7 +6031,7 @@ void Spell::EffectTransmitted(uint32 effIndex) linkedGO->SetSpellId(m_spellInfo->Id); linkedGO->SetOwnerGUID(m_caster->GetGUID() ); - MapManager::Instance().GetMap(linkedGO->GetMapId(), linkedGO)->Add(linkedGO); + linkedGO->GetMap()->Add(linkedGO); } else { diff --git a/src/game/TemporarySummon.cpp b/src/game/TemporarySummon.cpp index 928cd3fe1..0d653b2b2 100644 --- a/src/game/TemporarySummon.cpp +++ b/src/game/TemporarySummon.cpp @@ -158,7 +158,7 @@ void TemporarySummon::Summon(TempSummonType type, uint32 lifetime) m_timer = lifetime; m_lifetime = lifetime; - MapManager::Instance().GetMap(GetMapId(), this)->Add((Creature*)this); + GetMap()->Add((Creature*)this); AIM_Initialize(); } diff --git a/src/game/TotemAI.cpp b/src/game/TotemAI.cpp index f3f280ce1..572a8b04d 100644 --- a/src/game/TotemAI.cpp +++ b/src/game/TotemAI.cpp @@ -93,8 +93,8 @@ TotemAI::UpdateAI(const uint32 /*diff*/) TypeContainerVisitor, WorldTypeMapContainer > world_object_checker(checker); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, grid_object_checker, *MapManager::Instance().GetMap(i_totem.GetMapId(), &i_totem)); - cell_lock->Visit(cell_lock, world_object_checker, *MapManager::Instance().GetMap(i_totem.GetMapId(), &i_totem)); + cell_lock->Visit(cell_lock, grid_object_checker, *i_totem.GetMap()); + cell_lock->Visit(cell_lock, world_object_checker, *i_totem.GetMap()); } // If have target diff --git a/src/game/Transports.cpp b/src/game/Transports.cpp index 5bcbb5f23..c5606aff9 100644 --- a/src/game/Transports.cpp +++ b/src/game/Transports.cpp @@ -105,7 +105,7 @@ void MapManager::LoadTransports() //If we someday decide to use the grid to track transports, here: //MapManager::Instance().LoadGrid(mapid,x,y,true); - //MapManager::Instance().GetMap(t->GetMapId())->Add((GameObject *)t); + //t->GetMap()->Add((GameObject *)t); ++count; } while(result->NextRow()); delete result; @@ -431,11 +431,11 @@ Transport::WayPointMap::iterator Transport::GetNextWayPoint() void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) { - //MapManager::Instance().GetMap(oldMapid)->Remove((GameObject *)this, false); + //GetMap()->Remove((GameObject *)this, false); SetMapId(newMapid); //MapManager::Instance().LoadGrid(newMapid,x,y,true); Relocate(x, y, z); - //MapManager::Instance().GetMap(newMapid)->Add((GameObject *)this); + //GetMap()->Add((GameObject *)this); for(PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();) { diff --git a/src/game/Traveller.h b/src/game/Traveller.h index 8a7a85d3d..1d50d488a 100644 --- a/src/game/Traveller.h +++ b/src/game/Traveller.h @@ -65,7 +65,7 @@ inline float Traveller::Speed() template<> inline void Traveller::Relocation(float x, float y, float z, float orientation) { - MapManager::Instance().GetMap(i_traveller.GetMapId(), &i_traveller)->CreatureRelocation(&i_traveller, x, y, z, orientation); + i_traveller.GetMap()->CreatureRelocation(&i_traveller, x, y, z, orientation); } template<> @@ -87,7 +87,7 @@ inline float Traveller::Speed() template<> inline void Traveller::Relocation(float x, float y, float z, float orientation) { - MapManager::Instance().GetMap(i_traveller.GetMapId(), &i_traveller)->PlayerRelocation(&i_traveller, x, y, z, orientation); + i_traveller.GetMap()->PlayerRelocation(&i_traveller, x, y, z, orientation); } template<> diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index f586a11fa..36610f4f4 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4112,7 +4112,7 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) if (IsSingleTargetSpell(AurSpellInfo)) { caster = Aur->GetCaster(); - if(!caster) + if(caster) { AuraList& scAuras = caster->GetSingleCastAuras(); scAuras.remove(Aur); @@ -8786,7 +8786,7 @@ void Unit::SetVisibility(UnitVisibility x) if(IsInWorld()) { - Map *m = MapManager::Instance().GetMap(GetMapId(), this); + Map *m = GetMap(); if(GetTypeId()==TYPEID_PLAYER) m->PlayerRelocation((Player*)this,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation()); @@ -10549,8 +10549,8 @@ Unit* Unit::SelectNearbyTarget() const TypeContainerVisitor, GridTypeMapContainer > grid_unit_searcher(searcher); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this)); - cell_lock->Visit(cell_lock, grid_unit_searcher, *MapManager::Instance().GetMap(GetMapId(), this)); + cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap()); + cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap()); } // remove current target diff --git a/src/game/World.cpp b/src/game/World.cpp index f54541931..ecf95a6dc 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1659,7 +1659,7 @@ void World::ScriptsProcess() break; } ((Unit *)source)->SendMonsterMoveWithSpeed(step.script->x, step.script->y, step.script->z, ((Unit *)source)->GetUnitMovementFlags(), step.script->datalong2 ); - MapManager::Instance().GetMap(((Unit *)source)->GetMapId(), ((Unit *)source))->CreatureRelocation(((Creature *)source), step.script->x, step.script->y, step.script->z, 0); + ((Unit *)source)->GetMap()->CreatureRelocation(((Creature *)source), step.script->x, step.script->y, step.script->z, 0); break; case SCRIPT_COMMAND_FLAG_SET: if(!source) @@ -1785,7 +1785,7 @@ void World::ScriptsProcess() TypeContainerVisitor, GridTypeMapContainer > object_checker(checker); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(summoner->GetMapId(), summoner)); + cell_lock->Visit(cell_lock, object_checker, *summoner->GetMap()); if ( !go ) { @@ -1809,7 +1809,7 @@ void World::ScriptsProcess() go->SetLootState(GO_READY); go->SetRespawnTime(time_to_despawn); //despawn object in ? seconds - MapManager::Instance().GetMap(go->GetMapId(), go)->Add(go); + go->GetMap()->Add(go); break; } case SCRIPT_COMMAND_OPEN_DOOR: @@ -1846,7 +1846,7 @@ void World::ScriptsProcess() TypeContainerVisitor, GridTypeMapContainer > object_checker(checker); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(caster->GetMapId(), (Unit*)source)); + cell_lock->Visit(cell_lock, object_checker, *caster->GetMap()); if ( !door ) { @@ -1902,7 +1902,7 @@ void World::ScriptsProcess() TypeContainerVisitor, GridTypeMapContainer > object_checker(checker); CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, object_checker, *MapManager::Instance().GetMap(caster->GetMapId(), (Unit*)source)); + cell_lock->Visit(cell_lock, object_checker, *caster->GetMap()); if ( !door ) { diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 16ec9d3b9..8a54cc802 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -364,7 +364,7 @@ void WorldSession::LogoutPlayer(bool Save) // the player may not be in the world when logging out // e.g if he got disconnected during a transfer to another map // calls to GetMap in this case may cause crashes - if(_player->IsInWorld()) MapManager::Instance().GetMap(_player->GetMapId(), _player)->Remove(_player, false); + if(_player->IsInWorld()) _player->GetMap()->Remove(_player, false); // RemoveFromWorld does cleanup that requires the player to be in the accessor ObjectAccessor::Instance().RemoveObject(_player); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1cf8f518c..b00550a9b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "6833" + #define REVISION_NR "6836" #endif // __REVISION_NR_H__ diff --git a/win/VC80/game.vcproj b/win/VC80/game.vcproj index da5ca04dc..92ad32fde 100644 --- a/win/VC80/game.vcproj +++ b/win/VC80/game.vcproj @@ -125,7 +125,7 @@ />