mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Maps: All RespawnInfo* handed to outside code are now RespawnInfo const*, to signify that outside code has zero business changing these.
(cherry picked from commit 803dc789e4)
This commit is contained in:
@@ -3218,9 +3218,11 @@ bool Map::CheckRespawn(RespawnInfo* info)
|
||||
return true;
|
||||
}
|
||||
|
||||
void Map::Respawn(RespawnInfo* info, CharacterDatabaseTransaction dbTrans)
|
||||
void Map::Respawn(RespawnInfo const* info, CharacterDatabaseTransaction dbTrans)
|
||||
{
|
||||
info->respawnTime = GameTime::GetGameTime();
|
||||
if (info->respawnTime <= GameTime::GetGameTime())
|
||||
return;
|
||||
const_cast<RespawnInfo*>(info)->respawnTime = GameTime::GetGameTime();
|
||||
_respawnTimes.increase(info->handle);
|
||||
SaveRespawnInfoDB(*info, dbTrans);
|
||||
}
|
||||
@@ -3283,14 +3285,14 @@ bool Map::AddRespawnInfo(RespawnInfo const& info)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void PushRespawnInfoFrom(std::vector<RespawnInfo*>& data, RespawnInfoMap const& map)
|
||||
static void PushRespawnInfoFrom(std::vector<RespawnInfo const*>& data, RespawnInfoMap const& map)
|
||||
{
|
||||
data.reserve(data.size() + map.size());
|
||||
for (auto const& pair : map)
|
||||
data.push_back(pair.second);
|
||||
}
|
||||
|
||||
void Map::GetRespawnInfo(std::vector<RespawnInfo*>& respawnData, SpawnObjectTypeMask types) const
|
||||
void Map::GetRespawnInfo(std::vector<RespawnInfo const*>& respawnData, SpawnObjectTypeMask types) const
|
||||
{
|
||||
if (types & SPAWN_TYPEMASK_CREATURE)
|
||||
PushRespawnInfoFrom(respawnData, _creatureRespawnTimesBySpawnId);
|
||||
@@ -3298,7 +3300,7 @@ void Map::GetRespawnInfo(std::vector<RespawnInfo*>& respawnData, SpawnObjectType
|
||||
PushRespawnInfoFrom(respawnData, _gameObjectRespawnTimesBySpawnId);
|
||||
}
|
||||
|
||||
RespawnInfo* Map::GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const
|
||||
RespawnInfo const* Map::GetRespawnInfo(SpawnObjectType type, ObjectGuid::LowType spawnId) const
|
||||
{
|
||||
RespawnInfoMap const* map = GetRespawnMapForType(type);
|
||||
if (!map)
|
||||
|
||||
Reference in New Issue
Block a user