Tweaks to zone shutdown code

This commit is contained in:
Akkadius 2018-05-12 03:31:47 -05:00
parent d43273fd1b
commit eb463eef97
3 changed files with 18 additions and 10 deletions

View File

@ -135,8 +135,7 @@ uint32 Timer::GetRemainingTime() {
return 0;
else
return (start_time + timer_time) - current_time;
}
else {
} else {
return 0xFFFFFFFF;
}
}

View File

@ -541,11 +541,6 @@ int main(int argc, char** argv) {
if (previous_loaded && !current_loaded) {
process_timer.Stop();
process_timer.Start(1000, true);
if (zone && zone->GetZoneID() && zone->GetInstanceVersion()) {
uint32 shutdown_timer = database.getZoneShutDownDelay(zone->GetZoneID(), zone->GetInstanceVersion());
zone->StartShutdownTimer(shutdown_timer);
}
}
else if (!previous_loaded && current_loaded) {
process_timer.Stop();

View File

@ -150,8 +150,15 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
zone->RequestUCSServerStatus();
/* Set Logging */
/**
* Set Shutdown timer
*/
uint32 shutdown_timer = static_cast<uint32>(database.getZoneShutDownDelay(zone->GetZoneID(), zone->GetInstanceVersion()));
zone->StartShutdownTimer(shutdown_timer);
/*
* Set Logging
*/
LogSys.StartFileLogs(StringFormat("%s_version_%u_inst_id_%u_port_%u", zone->GetShortName(), zone->GetInstanceVersion(), zone->GetInstanceID(), ZoneConfig::get()->ZonePort));
return true;
@ -1427,11 +1434,18 @@ bool Zone::HasWeather()
void Zone::StartShutdownTimer(uint32 set_time) {
if (set_time > autoshutdown_timer.GetRemainingTime()) {
if (set_time == (RuleI(Zone, AutoShutdownDelay))) {
set_time = database.getZoneShutDownDelay(GetZoneID(), GetInstanceVersion());
set_time = static_cast<uint32>(database.getZoneShutDownDelay(GetZoneID(), GetInstanceVersion()));
}
autoshutdown_timer.SetTimer(set_time);
Log(Logs::General, Logs::Zone_Server, "Zone::StartShutdownTimer set to %u", set_time);
}
Log(Logs::Detail, Logs::Zone_Server,
"Zone::StartShutdownTimer trigger - set_time: %u remaining_time: %u diff: %i",
set_time,
autoshutdown_timer.GetRemainingTime(),
(set_time - autoshutdown_timer.GetRemainingTime())
);
}
bool Zone::Depop(bool StartSpawnTimer) {