From 5b9fec5f0befaa96221ccf57285cdb4f1a1faf2e Mon Sep 17 00:00:00 2001 From: Treeston Date: Fri, 1 Jan 2021 04:03:19 +0100 Subject: Core/Maps: Move some more Map internals to actually be... internals. (cherry picked from commit 94c03b2107ad6603aaf185d58d63480e79c97e76) --- src/server/game/Maps/Map.cpp | 6 +++--- src/server/game/Maps/Map.h | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src/server') diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index b20c50fd19e..06586100fa0 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -3218,11 +3218,11 @@ bool Map::CheckRespawn(RespawnInfo* info) return true; } -void Map::Respawn(RespawnInfo const* info, CharacterDatabaseTransaction dbTrans) +void Map::Respawn(RespawnInfo* info, CharacterDatabaseTransaction dbTrans) { if (info->respawnTime <= GameTime::GetGameTime()) return; - const_cast(info)->respawnTime = GameTime::GetGameTime(); + info->respawnTime = GameTime::GetGameTime(); _respawnTimes.increase(info->handle); SaveRespawnInfoDB(*info, dbTrans); } @@ -3300,7 +3300,7 @@ void Map::GetRespawnInfo(std::vector& respawnData, SpawnObje PushRespawnInfoFrom(respawnData, _gameObjectRespawnTimesBySpawnId); } -RespawnInfo const* Map::GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const +RespawnInfo* Map::GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const { RespawnInfoMap const* map = GetRespawnMapForType(type); if (!map) diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index cddca2e5d2c..24e21fa72a7 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -232,10 +232,10 @@ struct CompareRespawnInfo { bool operator()(RespawnInfo const* a, RespawnInfo const* b) const; }; -typedef std::unordered_map ZoneDynamicInfoMap; -typedef boost::heap::fibonacci_heap> RespawnListContainer; -typedef RespawnListContainer::handle_type RespawnListHandle; -typedef std::unordered_map RespawnInfoMap; +using ZoneDynamicInfoMap = std::unordered_map; +using RespawnListContainer = boost::heap::fibonacci_heap>; +using RespawnListHandle = RespawnListContainer::handle_type; +using RespawnInfoMap = std::unordered_map; struct RespawnInfo { SpawnObjectType type; @@ -763,22 +763,22 @@ class TC_GAME_API Map : public GridRefManager void DoRespawn(SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 gridId); bool AddRespawnInfo(RespawnInfo const& info); void UnloadAllRespawnInfos(); + RespawnInfo* GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const; + void Respawn(RespawnInfo* info, CharacterDatabaseTransaction dbTrans = nullptr); void DeleteRespawnInfo(RespawnInfo* info, CharacterDatabaseTransaction dbTrans = nullptr); void DeleteRespawnInfoFromDB(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans = nullptr); public: void GetRespawnInfo(std::vector& respawnData, SpawnObjectTypeMask types) const; - RespawnInfo const* GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const; void Respawn(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans = nullptr) { - if (RespawnInfo const* info = GetRespawnInfo(type, spawnId)) + if (RespawnInfo* info = GetRespawnInfo(type, spawnId)) Respawn(info, dbTrans); } - void Respawn(RespawnInfo const* info, CharacterDatabaseTransaction dbTrans = nullptr); void RemoveRespawnTime(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans = nullptr, bool alwaysDeleteFromDB = false) { - if (RespawnInfo const* info = GetRespawnInfo(type, spawnId)) - DeleteRespawnInfo(const_cast(info), dbTrans); + if (RespawnInfo* info = GetRespawnInfo(type, spawnId)) + DeleteRespawnInfo(info, dbTrans); // Some callers might need to make sure the database doesn't contain any respawn time else if (alwaysDeleteFromDB) DeleteRespawnInfoFromDB(type, spawnId, dbTrans); -- cgit v1.2.3