Core/Spawns: Exterminate CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY with extreme prejudice. (It didn't work anyway.)

(cherry picked from commit 26440857c1a74031ea0a0234ca0b0fcb09b6bcb0)
This commit is contained in:
Treeston
2021-12-16 01:18:15 +01:00
committed by Shauren
parent be05590a12
commit d5e58cef69
11 changed files with 16 additions and 59 deletions
@@ -669,7 +669,7 @@ void GameObject::Update(uint32 diff)
SetRespawnTime(WEEK);
else
m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime) + urand(5, MINUTE); // else copy time from master and add a little
SaveRespawnTime(); // also save to DB immediately
SaveRespawnTime();
return;
}
@@ -730,7 +730,7 @@ void GameObject::Update(uint32 diff)
// Set respawn timer
if (!m_respawnCompatibilityMode && m_respawnTime > 0)
SaveRespawnTime(0, false);
SaveRespawnTime();
if (isSpawned())
{
@@ -967,22 +967,13 @@ void GameObject::Update(uint32 diff)
// if option not set then object will be saved at grid unload
// Otherwise just save respawn time to map object memory
if (sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
SaveRespawnTime();
SaveRespawnTime();
if (!m_respawnCompatibilityMode)
{
// Respawn time was just saved if set to save to DB
// If not, we save only to map memory
if (!sWorld->getBoolConfig(CONFIG_SAVE_RESPAWN_TIME_IMMEDIATELY))
SaveRespawnTime(0, false);
// Then despawn
if (m_respawnCompatibilityMode)
DestroyForNearbyPlayers();
else
AddObjectToRemoveList();
return;
}
DestroyForNearbyPlayers(); // old UpdateObjectVisibility()
break;
}
@@ -1389,7 +1380,7 @@ bool GameObject::IsDestructibleBuilding() const
return gInfo->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING;
}
void GameObject::SaveRespawnTime(uint32 forceDelay, bool savetodb)
void GameObject::SaveRespawnTime(uint32 forceDelay)
{
if (m_goData && (forceDelay || m_respawnTime > GameTime::GetGameTime()) && m_spawnedByDefault)
{
@@ -1400,7 +1391,7 @@ void GameObject::SaveRespawnTime(uint32 forceDelay, bool savetodb)
}
uint32 thisRespawnTime = forceDelay ? GameTime::GetGameTime() + forceDelay : m_respawnTime;
GetMap()->SaveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()).GetId(), m_goData->dbData ? savetodb : false);
GetMap()->SaveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()).GetId());
}
}