From 2a8fe0df8a46432d648cfb8a80b6049a4ea20afe Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Mon, 2 Nov 2026 21:54:00 +0000 Subject: [PATCH] Maintenance: [forced, user-approved] Family G7: remove WindowRetirement, PlayerNameContext, AutomaticSkillContext. (a) WindowRetireme Batch #10200 by ragnarok-clanker: forced by an admin (2 lower score(s), 7 changed function(s)); checked with 43 compiled unit(s), including every includer of Source/Contents/PlayerNameDictionary.h, Source/Contents/Skills/AutomaticSkills.h, Source/UI/Window/WindowRetirement.h. Deletes: Source/UI/Window/WindowRetirement.h --- Source/Contents/PlayerNameDictionary.cpp | 8 ++---- Source/Contents/PlayerNameDictionary.h | 13 +-------- Source/Contents/Skills/AutomaticSkills.cpp | 17 ++++++------ Source/Contents/Skills/AutomaticSkills.h | 13 ++------- Source/UI/Window/WindowRetirement.cpp | 32 ---------------------- Source/UI/Window/WindowRetirement.h | 15 ---------- 6 files changed, 14 insertions(+), 84 deletions(-) delete mode 100644 Source/UI/Window/WindowRetirement.h diff --git a/Source/Contents/PlayerNameDictionary.cpp b/Source/Contents/PlayerNameDictionary.cpp index 0cd18c1c..3bb14cb6 100644 --- a/Source/Contents/PlayerNameDictionary.cpp +++ b/Source/Contents/PlayerNameDictionary.cpp @@ -8,11 +8,7 @@ #include // INLINED -CPlayerNameDictionary::CPlayerNameDictionary(PlayerNameContext& context) : m_enabled(true), m_context(&context) { -} - -// INLINED -CPlayerNameDictionary::CPlayerNameDictionary() : m_enabled(true), m_context(nullptr) { +CPlayerNameDictionary::CPlayerNameDictionary() : m_enabled(true) { } // OFFSET: 0x0060A9D0 @@ -87,7 +83,7 @@ void CPlayerNameDictionary::Update() { const std::uint16_t header = 873; std::memcpy(packet, &header, sizeof(header)); std::memcpy(packet + 2, &id, sizeof(id)); - this->m_context->connection.Send(sizeof(packet), packet); + GetRagConnection().Send(sizeof(packet), packet); this->m_requests.push_back({id, timeGetTime()}); } diff --git a/Source/Contents/PlayerNameDictionary.h b/Source/Contents/PlayerNameDictionary.h index 3801b3e8..4fe68c71 100644 --- a/Source/Contents/PlayerNameDictionary.h +++ b/Source/Contents/PlayerNameDictionary.h @@ -8,19 +8,9 @@ #include #include -class CConnection; - -struct PlayerNameContext { - CConnection& connection; - const bool& languagePrefix; - const int& service; - const WORD& language; -}; - class CPlayerNameDictionary { public: CPlayerNameDictionary(); - explicit CPlayerNameDictionary(PlayerNameContext& context); virtual ~CPlayerNameDictionary(); std::string Lookup(std::uint32_t id); void Set(std::uint32_t id, std::string name); @@ -49,11 +39,10 @@ private: /* 0008 */ std::map m_names; /* 0010 */ std::deque m_pending; /* 0024 */ std::deque m_requests; - PlayerNameContext* m_context; }; #if defined(_WIN32) && !defined(_WIN64) -static_assert(sizeof(CPlayerNameDictionary) == 60); +static_assert(sizeof(CPlayerNameDictionary) == 0x38); #endif extern CPlayerNameDictionary* g_playerNameDictionary; diff --git a/Source/Contents/Skills/AutomaticSkills.cpp b/Source/Contents/Skills/AutomaticSkills.cpp index 311c65de..de4937e9 100644 --- a/Source/Contents/Skills/AutomaticSkills.cpp +++ b/Source/Contents/Skills/AutomaticSkills.cpp @@ -1,5 +1,6 @@ #include "Contents/Skills/AutomaticSkills.h" #include "Client/Session.h" +#include "Network/Connection/Connection.h" #include @@ -19,15 +20,15 @@ namespace { } // INLINED - void Cancel(CConnection& connection, std::int16_t id) { + void Cancel(std::int16_t id) { const std::uint16_t packet[2] = {2833, static_cast(id)}; - connection.Send(sizeof(packet), packet); + GetRagConnection().Send(sizeof(packet), packet); } } // OFFSET: 0x007AEEE0 // FUNCTION: fn_09148 -AutomaticSkills::AutomaticSkills(AutomaticSkillContext& context) : m_ids{2036, 6601, 6552}, m_context(&context) { +AutomaticSkills::AutomaticSkills() : m_ids{2036, 6601, 6552} { } // OFFSET: 0x007AF130 @@ -60,13 +61,13 @@ int AutomaticSkills::CancelOption(std::int16_t id) { // OFFSET: 0x007AF2A0 // FUNCTION: fn_09150 void AutomaticSkills::DisableAll() { - this->m_context->activeKey = 0; + g_session.unknown_61A4 = 0; for (int id : this->m_ids) { const auto skill = static_cast(id); const int option = ActiveOption(skill); if (g_session.GetOption(option) != 0) { - Cancel(this->m_context->connection, skill); + Cancel(skill); g_session.SetOption(option, 0, 0); } } @@ -81,14 +82,14 @@ void AutomaticSkills::Use(std::int16_t id, std::int16_t level, std::uint32_t tar std::memcpy(packet + 2, &id, 2); std::memcpy(packet + 4, &level, 2); std::memcpy(packet + 6, &target, 4); - this->m_context->connection.Send(sizeof(packet), packet); + GetRagConnection().Send(sizeof(packet), packet); const int cancel = AutomaticSkills::CancelOption(id); if (g_session.GetOption(cancel) != 0) { - Cancel(this->m_context->connection, id); + Cancel(id); g_session.SetOption(cancel, 0, 0); } else { - this->m_context->activeKey = this->m_context->currentKey; + g_session.unknown_61A4 = *reinterpret_cast(g_session.unknown_61A8_0000); g_session.SetOption(ActiveOption(id), 1, 0); } } diff --git a/Source/Contents/Skills/AutomaticSkills.h b/Source/Contents/Skills/AutomaticSkills.h index f44a86a6..5e246815 100644 --- a/Source/Contents/Skills/AutomaticSkills.h +++ b/Source/Contents/Skills/AutomaticSkills.h @@ -1,20 +1,12 @@ #ifndef RAGNAROK_SOURCE_CONTENTS_SKILLS_AUTOMATICSKILLS_H #define RAGNAROK_SOURCE_CONTENTS_SKILLS_AUTOMATICSKILLS_H -#include "Network/Connection/Connection.h" - #include #include -struct AutomaticSkillContext { - CConnection& connection; - int& activeKey; - const int& currentKey; -}; - class AutomaticSkills { public: - explicit AutomaticSkills(AutomaticSkillContext& context); + AutomaticSkills(); ~AutomaticSkills(); bool Contains(int id) const; static int CancelOption(std::int16_t id); @@ -24,13 +16,12 @@ public: private: /* 0000 */ std::set m_ids; - AutomaticSkillContext* m_context; AutomaticSkills(const AutomaticSkills&) = delete; AutomaticSkills& operator=(const AutomaticSkills&) = delete; }; #if defined(_WIN32) && !defined(_WIN64) -static_assert(sizeof(AutomaticSkills) == 12); +static_assert(sizeof(AutomaticSkills) == 8); #endif #endif diff --git a/Source/UI/Window/WindowRetirement.cpp b/Source/UI/Window/WindowRetirement.cpp index f8ac2705..a9216f95 100644 --- a/Source/UI/Window/WindowRetirement.cpp +++ b/Source/UI/Window/WindowRetirement.cpp @@ -2,7 +2,6 @@ #include "UI/Layout/SnapMgr.h" #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" -#include "UI/Window/WindowRetirement.h" #include @@ -78,37 +77,6 @@ void UIWindowMgr::DismissTransient() { } } -// INLINED -void WindowRetirement::DrainPending( - const std::deque& modal, UIWindow*& reference_4F16C, UIWindow*& capture, UIWindow*& input, UIWindow*& hover -) { - if (!modal.empty() && modal.back()) { - return; - } - - for (UIWindow* window : this->windows.retired) { - if (reference_4F16C == window) { - reference_4F16C = nullptr; - } - - if (capture && (capture == window || capture->IsDescendantOf(window))) { - capture = nullptr; - } - - if (input && (input == window || input->IsDescendantOf(window))) { - input = nullptr; - } - - if (hover && (hover == window || hover->IsDescendantOf(window))) { - hover = nullptr; - } - - this->windows.Destroy(window); - } - - this->windows.retired.clear(); -} - // OFFSET: 0x00A8F840 // FUNCTION: fn_17145 void UIWindowMgr::DestroyWindow0478() { diff --git a/Source/UI/Window/WindowRetirement.h b/Source/UI/Window/WindowRetirement.h deleted file mode 100644 index 57b758b4..00000000 --- a/Source/UI/Window/WindowRetirement.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef RAGNAROK_SOURCE_UI_WINDOW_WINDOWRETIREMENT_H -#define RAGNAROK_SOURCE_UI_WINDOW_WINDOWRETIREMENT_H - -#include - -class UIWindow; -class UIWindowMgr; - -struct WindowRetirement { - UIWindowMgr& windows; - - void DrainPending(const std::deque& modal, UIWindow*& reference_4F16C, UIWindow*& capture, UIWindow*& input, UIWindow*& hover); -}; - -#endif