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
This commit is contained in:
parent
3d4018f041
commit
2a8fe0df8a
6 changed files with 14 additions and 84 deletions
|
|
@ -8,11 +8,7 @@
|
|||
#include <timeapi.h>
|
||||
|
||||
// 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()});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,19 +8,9 @@
|
|||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
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<std::uint32_t, Entry> m_names;
|
||||
/* 0010 */ std::deque<std::uint32_t> m_pending;
|
||||
/* 0024 */ std::deque<Request> 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;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "Contents/Skills/AutomaticSkills.h"
|
||||
#include "Client/Session.h"
|
||||
#include "Network/Connection/Connection.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
|
|
@ -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<std::uint16_t>(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<std::int16_t>(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<int*>(g_session.unknown_61A8_0000);
|
||||
g_session.SetOption(ActiveOption(id), 1, 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,12 @@
|
|||
#ifndef RAGNAROK_SOURCE_CONTENTS_SKILLS_AUTOMATICSKILLS_H
|
||||
#define RAGNAROK_SOURCE_CONTENTS_SKILLS_AUTOMATICSKILLS_H
|
||||
|
||||
#include "Network/Connection/Connection.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
|
||||
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<int> 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
|
||||
|
|
|
|||
|
|
@ -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 <algorithm>
|
||||
|
||||
|
|
@ -78,37 +77,6 @@ void UIWindowMgr::DismissTransient() {
|
|||
}
|
||||
}
|
||||
|
||||
// INLINED
|
||||
void WindowRetirement::DrainPending(
|
||||
const std::deque<UIWindow*>& 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() {
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
#ifndef RAGNAROK_SOURCE_UI_WINDOW_WINDOWRETIREMENT_H
|
||||
#define RAGNAROK_SOURCE_UI_WINDOW_WINDOWRETIREMENT_H
|
||||
|
||||
#include <deque>
|
||||
|
||||
class UIWindow;
|
||||
class UIWindowMgr;
|
||||
|
||||
struct WindowRetirement {
|
||||
UIWindowMgr& windows;
|
||||
|
||||
void DrainPending(const std::deque<UIWindow*>& modal, UIWindow*& reference_4F16C, UIWindow*& capture, UIWindow*& input, UIWindow*& hover);
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue