Scale timers

This commit is contained in:
David Markowitz 2022-12-16 04:02:54 -08:00
parent 0d460c0eb3
commit b33a3df012

View File

@ -314,17 +314,24 @@ int main(int argc, char** argv) {
newFrameDelta = PerformanceManager::GetServerFrameDelta();
}
// Update to the new framerate
// Update to the new framerate and scale all timings to said new framerate
if (newFrameDelta != currentFrameDelta) {
float_t ratioBeforeToAfter = (float)currentFrameDelta / (float)newFrameDelta;
currentFrameDelta = newFrameDelta;
currentFramerate = MS_TO_FRAMES(newFrameDelta);
Game::logger->LogDebug("WorldServer", "Framerate for zone/instance/clone %i/%i/%i is now %i", zoneID, instanceID, cloneID, currentFramerate);
logFlushTime = 15 * currentFramerate; // 15 seconds in frames
framesSinceLastFlush *= ratioBeforeToAfter;
shutdownTimeout = 10 * 60 * currentFramerate; // 10 minutes in frames
framesSinceLastUser *= ratioBeforeToAfter;
noMasterConnectionTimeout = 5 * currentFramerate; // 5 seconds in frames
framesSinceMasterDisconnect *= ratioBeforeToAfter;
chatReconnectionTime = 30 * currentFramerate; // 30 seconds in frames
framesSinceChatDisconnect *= ratioBeforeToAfter;
saveTime = 10 * 60 * currentFramerate; // 10 minutes in frames
framesSinceLastUsersSave *= ratioBeforeToAfter;
sqlPingTime = 10 * 60 * currentFramerate; // 10 minutes in frames
framesSinceLastSQLPing *= ratioBeforeToAfter;
}
//Warning if we ran slow