Batch #4107 by Millenium: 0 byte-identical, 2 confirmed by peer review. - fn_19730 CShutDownSchedule::UpdateNotice: logic confirmed by peer review - fn_19731 CShutDownSchedule::Process: logic confirmed by peer review Peer-reviewed-by: youko, superintelligence Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes). Adds to the build: Source/Contents/Schedule/ShutDownSchedule.cpp
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#include "Contents/Schedule/ShutDownSchedule.h"
|
|
|
|
#include "Client/Mode/ModeMgr.h"
|
|
#include "Contents/MessageTable.h"
|
|
#include "UI/Window/UIWindowMgr.h"
|
|
|
|
// GLOBAL: gl_24854
|
|
double s_shutDownNoticeSeconds[6] = {1800.0, 900.0, 600.0, 300.0, 180.0, 60.0};
|
|
|
|
// OFFSET: 0x00BA8CC0
|
|
// FUNCTION: fn_19730
|
|
void CShutDownSchedule::UpdateNotice() {
|
|
if (this->noticeIndex >= 6) {
|
|
return;
|
|
}
|
|
|
|
while (true) {
|
|
const int diff = static_cast<int>(static_cast<double>(this->seconds) - s_shutDownNoticeSeconds[this->noticeIndex]);
|
|
if (diff >= 0) {
|
|
this->interval = static_cast<std::int64_t>(diff) * 1000;
|
|
return;
|
|
}
|
|
|
|
++this->noticeIndex;
|
|
if (this->noticeIndex >= 6) {
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00BA8E00
|
|
// FUNCTION: fn_19731
|
|
void CShutDownSchedule::Process(const std::uint64_t& now) {
|
|
if (this->noticeIndex < 6) {
|
|
if (g_modeMgr.GetGameMode()) {
|
|
g_windowMgr.SendNotice(1, reinterpret_cast<std::intptr_t>(LookupMessage(2020)), 0xFFFF, 0, 0, 0);
|
|
++this->noticeIndex;
|
|
this->UpdateNotice();
|
|
}
|
|
} else {
|
|
this->active = false;
|
|
}
|
|
}
|