Core/Maps: Move some more Map internals to actually be... internals.

(cherry picked from commit 94c03b2107)
This commit is contained in:
Treeston
2021-01-01 04:03:19 +01:00
committed by Shauren
parent b5f3a6fd80
commit 5b9fec5f0b
2 changed files with 12 additions and 12 deletions

View File

@@ -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<RespawnInfo*>(info)->respawnTime = GameTime::GetGameTime();
info->respawnTime = GameTime::GetGameTime();
_respawnTimes.increase(info->handle);
SaveRespawnInfoDB(*info, dbTrans);
}
@@ -3300,7 +3300,7 @@ void Map::GetRespawnInfo(std::vector<RespawnInfo const*>& 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)

View File

@@ -232,10 +232,10 @@ struct CompareRespawnInfo
{
bool operator()(RespawnInfo const* a, RespawnInfo const* b) const;
};
typedef std::unordered_map<uint32 /*zoneId*/, ZoneDynamicInfo> ZoneDynamicInfoMap;
typedef boost::heap::fibonacci_heap<RespawnInfo*, boost::heap::compare<CompareRespawnInfo>> RespawnListContainer;
typedef RespawnListContainer::handle_type RespawnListHandle;
typedef std::unordered_map<ObjectGuid::LowType, RespawnInfo*> RespawnInfoMap;
using ZoneDynamicInfoMap = std::unordered_map<uint32 /*zoneId*/, ZoneDynamicInfo>;
using RespawnListContainer = boost::heap::fibonacci_heap<RespawnInfo*, boost::heap::compare<CompareRespawnInfo>>;
using RespawnListHandle = RespawnListContainer::handle_type;
using RespawnInfoMap = std::unordered_map<ObjectGuid::LowType, RespawnInfo*>;
struct RespawnInfo
{
SpawnObjectType type;
@@ -763,22 +763,22 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
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<RespawnInfo const*>& 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<RespawnInfo*>(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);