aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/Map.cpp
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2020-12-31 18:56:53 +0100
committerTreeston <treeston.mmoc@gmail.com>2020-12-31 18:57:18 +0100
commit803dc789e42ea2298a8bd1822849b6f2df82efe6 (patch)
tree67d44865ecbdeda895842128ae04dbfebbcffc65 /src/server/game/Maps/Map.cpp
parent7d70fbc64c602cf163c55c98ec4b303efdefc03d (diff)
Core/Maps: All RespawnInfo* handed to outside code are now RespawnInfo const*, to signify that outside code has zero business changing these.
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rw-r--r--src/server/game/Maps/Map.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 912a68e5d31..d727ed452f8 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -3093,9 +3093,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);
}
@@ -3156,14 +3158,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);
@@ -3171,7 +3173,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);
auto it = map.find(spawnId);