Core/Misc: Various dynspawn cleanup and refactors split off from pooling rewrite:

- Map::RemoveRespawnTime(SpawnObjectType, LowType, doRespawn) split into Map::Respawn and Map::RemoveRespawnTime, without the extra boolean
- Map::RemoveRespawnTime(RespawnInfo*) merged into Map::DeleteRespawnInfo(RespawnInfo*) and is now private
- Map::DeleteRespawnInfo(void) renamed to Map::UnloadAllRespawnInfos to properly describe what it does
- Map::ProcessRespawns now actually saves the delayed respawn time to DB if the respawn was delayed
- Map::AddRespawnInfo now takes const reference, and returns success as a boolean
- Map::AddRespawnInfo no longer offers an unused "replace" parameter
- Map::DeleteRespawnInfo no longer offers a variety of unused private overloads
- Map::SaveRespawnTime no longer offers a tantalizing writeDB parameter. Parameter is now called "startup" to properly describe what it does.
- Map::SaveRespawnInfoDB now takes RespawnInfo reference instead of all the various fields. Still public because compatibility mode. QQ.
- Map::GetWorldObjectBySpawnId sanitized
- Map::GetXRespawnTime methods sanitized to all go through Map::GetRespawnTime

----------

Core/DB: Unify `creature_respawn` and `gameobject_respawn` into a single `respawn` table
This commit is contained in:
Treeston authored and Ovahlord committed 2019-08-18 12:47:10 +02:00
1 parent f9184f026b
commit 90540d684b
15 files changed
+184 -236

No files matched your search

@@ -1004,7 +1004,7 @@ bool GameObject::LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap
toUnload.push_back(pair.second);
for (GameObject* obj : toUnload)
map->AddObjectToRemoveList(obj);
map->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, spawnId, false, trans);
map->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, spawnId, trans);
}
);
@@ -1094,12 +1094,16 @@ void GameObject::SaveRespawnTime(uint32 forceDelay, bool savetodb)
{
if (m_respawnCompatibilityMode)
{
GetMap()->SaveRespawnTimeDB(SPAWN_TYPE_GAMEOBJECT, m_spawnId, m_respawnTime);
RespawnInfo ri;
ri.type = SPAWN_TYPE_GAMEOBJECT;
ri.spawnId = m_spawnId;
ri.respawnTime = m_respawnTime;
GetMap()->SaveRespawnInfoDB(ri);
return;
}
uint32 thisRespawnTime = forceDelay ? time(nullptr) + forceDelay : m_respawnTime;
GetMap()->SaveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId, GetEntry(), thisRespawnTime, Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()).GetId(), m_goData->dbData ? savetodb : false);
GetMap()->SaveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId, GetEntry(), thisRespawnTime, Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()).GetId());
}
}
@@ -1182,7 +1186,7 @@ void GameObject::Respawn()
if (m_spawnedByDefault && m_respawnTime > 0)
{
m_respawnTime = time(nullptr);
GetMap()->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId, true);
GetMap()->Respawn(SPAWN_TYPE_GAMEOBJECT, m_spawnId);
}
}