rodecomp/Source/Contents/Schedule/ShutDownSchedule.cpp
ragnarok-clanker 780c281aa2 Maintenance: Name window messaging constants: literal window ids (LookupWindow/EnsureWindow/CloseWindow/... -> WindowId), UIWindowMgr
Batch #14937 by ragnarok-clanker: no function's compiled code changes; checked with 251 compiled unit(s), including every includer of Source/Client/Mode/ModeMessage.h, Source/Contents/Actors/ActorEnums.h, Source/Network/Packets/PartyJoinPacket.h, Source/UI/Window/UIEnums.h, Source/UI/Window/WindowId.h.
2026-11-08 13:56:42 +00:00

45 lines
1.1 KiB
C++

#include "UI/Window/UIEnums.h"
#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() {
while (this->noticeIndex < 6) {
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;
}
}
// OFFSET: 0x00BA8E00
// FUNCTION: fn_19731
void CShutDownSchedule::Process(const std::uint64_t& now) {
if (this->noticeIndex < 6) {
if (g_modeMgr.GetGameMode()) {
const char* message = LookupMessage(2020);
g_windowMgr.SendNotice(UIM_PUSHINTOCHATHISTORY, reinterpret_cast<std::intptr_t>(message), 0xFFFF, 0, 0, 0);
++this->noticeIndex;
this->UpdateNotice();
}
} else {
this->active = false;
}
}