rodecomp/Source/UI/Window/WindowRetirement.cpp
ragnarok-clanker f1e20439ff Confirm 3 functions in Source/UI/Window/WindowRegistration.cpp, Source/UI/Window/WindowRetirement.cpp, ...
Batch #14833 by kyoshi: 2 byte-identical, 1 confirmed by peer review.

- fn_17120 UIWindowMgr::RegisterWindow: byte-identical (already on main)
- fn_17219 UIWindowMgr::Schedule: byte-identical (already on main)
- fn_17208 UIWindowMgr::CreateLayoutWindow: logic confirmed by peer review (already on main)

Peer-reviewed-by: ragnarok-clanker, Tanke, codeplay
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
2026-11-07 19:13:25 +00:00

107 lines
2.7 KiB
C++

#include "Contents/Configuration/ServiceOptions.h"
#include "UI/Layout/SnapMgr.h"
#include "UI/Window/UIWindow.h"
#include "UI/Window/UIWindowMgr.h"
#include <algorithm>
extern template std::_List_node<UIWindow*, void*>* std::list<UIWindow*>::_Emplace<UIWindow* const&>(std::_List_node<UIWindow*, void*>* const, UIWindow* const&);
// OFFSET: 0x00AA2C90
// FUNCTION: fn_17219
__declspec(noinline) void UIWindowMgr::Schedule(UIWindow* window) {
if (window == this->window_03D4) {
this->window_03D4 = nullptr;
}
if (window == this->window_03D8) {
this->window_03D8 = nullptr;
}
if (window == this->window_03DC) {
this->window_03DC = nullptr;
}
if (window == this->window_01B8) {
this->window_01B8 = nullptr;
}
if (window == this->window_4F2AC) {
this->window_4F2AC = nullptr;
}
this->retired.push_back(window);
}
// OFFSET: 0x00AA7250
// FUNCTION: fn_17237
void UIWindowMgr::Destroy(UIWindow* window) {
const bool snappingEnabled = g_serviceOptions.Get(141) != 0;
if (!window) {
return;
}
const auto rendered = std::find(this->rendered.begin(), this->rendered.end(), window);
if (rendered != this->rendered.end()) {
if (snappingEnabled && g_serviceOptions.Get(141) != 0) {
this->snapRectangles.erase(window);
}
g_snapMgr.Remove(*rendered);
(*rendered)->Slot11();
delete *rendered;
this->rendered.erase(rendered);
return;
}
for (auto entry = this->overlays.begin(); entry != this->overlays.end(); ++entry) {
if (entry->second != window) {
continue;
}
entry->second->Slot11();
delete entry->second;
this->overlays.erase(entry);
return;
}
}
// OFFSET: 0x00AA71E0
// FUNCTION: fn_17235
void UIWindowMgr::DismissTransient() {
if (this->window_4F250) {
this->Schedule(this->window_4F250);
this->window_4F250 = nullptr;
}
}
// OFFSET: 0x00A8F840
// FUNCTION: fn_17145
void UIWindowMgr::DestroyWindow0478() {
if (this->unknown_0478) {
delete this->unknown_0478;
this->unknown_0478 = nullptr;
}
}
// OFFSET: 0x00A8FB80
// FUNCTION: fn_17147
void UIWindowMgr::SubmitActiveDialog() {
UIWindow* window = this->unknown_01F8;
if (window || (window = this->unknown_01F0) != nullptr || (window = this->unknown_01F4) != nullptr || (window = this->unknown_0214) != nullptr ||
(window = this->unknown_021C) != nullptr || (window = this->unknown_020C) != nullptr || (window = this->unknown_0374) != nullptr ||
(window = this->hoverWindow) != nullptr) {
window->SendMsg(nullptr, 19, 0, 0, 0, 0);
return;
}
for (auto entry = this->rendered.begin(); entry != this->rendered.end(); ++entry) {
if ((*entry)->Slot02()) {
(*entry)->SendMsg(nullptr, 19, 0, 0, 0, 0);
}
}
}