aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Maps/Map.cpp
diff options
context:
space:
mode:
authorGiacomo Pozzoni <giacomopoz@gmail.com>2020-04-11 12:07:57 +0000
committerGitHub <noreply@github.com>2020-04-11 14:07:57 +0200
commit4f33fd3932d362466ee017111895bf14fcc79c88 (patch)
treea446a043eaa8d5b6c84ce0389be85c9e09e85d88 /src/server/game/Maps/Map.cpp
parenteb31ae9b1839ff26246d68584937825bd7ce7932 (diff)
Core/Pooling: Remove respawn times from the database when despawning a pool (#24422)
* Core/Pooling: Remove respawn times from the database when despawning a pool Remove respawn times from the database when despawning a pool. This is needed when a Game Event ends but there are still some respawn times saved in the database. * Remove respawn time of active pool objects even if they are not spawned
Diffstat (limited to 'src/server/game/Maps/Map.cpp')
-rw-r--r--src/server/game/Maps/Map.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 710fe526874..105898a6d1d 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -3136,15 +3136,20 @@ void Map::DeleteRespawnInfo(RespawnInfo* info, CharacterDatabaseTransaction dbTr
_respawnTimes.erase(info->handle);
// database
+ DeleteRespawnInfoFromDB(info->type, info->spawnId, dbTrans);
+
+ // then cleanup the object
+ delete info;
+}
+
+void Map::DeleteRespawnInfoFromDB(SpawnObjectType type, ObjectGuid::LowType spawnId, CharacterDatabaseTransaction dbTrans)
+{
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_RESPAWN);
- stmt->setUInt16(0, info->type);
- stmt->setUInt32(1, info->spawnId);
+ stmt->setUInt16(0, type);
+ stmt->setUInt32(1, spawnId);
stmt->setUInt16(2, GetId());
stmt->setUInt32(3, GetInstanceId());
CharacterDatabase.ExecuteOrAppend(dbTrans, stmt);
-
- // then cleanup the object
- delete info;
}
void Map::DoRespawn(SpawnObjectType type, ObjectGuid::LowType spawnId, uint32 gridId)