Decompile 6 functions in Source/Contents/GuildMgr.cpp, Source/Contents/GuildMgr.h, ...

Batch #889 by ragnarok-clanker: 0 byte-identical, 6 confirmed by peer review.

- fn_05147 CGuild::CGuild: logic confirmed by peer review
- fn_05148 CGuild::~CGuild: logic confirmed by peer review
- fn_05172 CGuildMgr::Create: logic confirmed by peer review
- fn_05173 CGuildMgr::Destroy: logic confirmed by peer review
- fn_05175 CGuildMgr::GetEmblemVersion: logic confirmed by peer review
- fn_05181 CGuildMgr::SetEmblemVersion: logic confirmed by peer review

Reviewed-by: ragnarok-clanker
Adds to the build: Source/Contents/GuildMgr.cpp, Source/Contents/GuildEmblemState.cpp
This commit is contained in:
ragnarok-clanker 2026-10-26 21:46:02 +00:00
commit 7541fbec29
4 changed files with 134 additions and 0 deletions

View file

@ -0,0 +1,22 @@
#include "Contents/GuildMgr.h"
// FUNCTION: fn_05147
CGuild::CGuild() : m_emblemVersion(0) {
}
// FUNCTION: fn_05148
CGuild::~CGuild() = default;
// FUNCTION: fn_05175
int CGuildMgr::GetEmblemVersion(std::uint32_t guildId) const {
const auto it = this->m_guilds.find(guildId);
if (it != this->m_guilds.end()) {
return it->second.m_emblemVersion;
}
return 0;
}
// FUNCTION: fn_05181
void CGuildMgr::SetEmblemVersion(std::uint32_t guildId, int version) {
this->m_guilds[guildId].m_emblemVersion = version;
}

View file

@ -0,0 +1,52 @@
#include "Contents/GuildMgr.h"
#include "Contents/Emblems/GuildEmblemReqBundle.h"
#include <new>
// GLOBAL: gl_24555
CGuildMgr* g_guildMgr = nullptr;
// INLINED
CGuildMgr::CGuildMgr() : m_reqBundle(nullptr), m_timeout(0xC800) {
this->m_initialized = false;
this->m_reqBundle = new (std::nothrow) CGuildEmblemReqBundle();
if (this->m_reqBundle) {
this->m_initialized = true;
}
}
// INLINED
CGuildMgr::~CGuildMgr() {
if (this->m_reqBundle) {
delete this->m_reqBundle;
this->m_reqBundle = nullptr;
}
}
// FUNCTION: fn_05172
bool CGuildMgr::Create() {
if (g_guildMgr) {
return false;
}
g_guildMgr = new (std::nothrow) CGuildMgr();
if (!g_guildMgr) {
return false;
}
if (!g_guildMgr->m_initialized) {
delete g_guildMgr;
g_guildMgr = nullptr;
return false;
}
return true;
}
// FUNCTION: fn_05173
void CGuildMgr::Destroy() {
if (g_guildMgr) {
delete g_guildMgr;
g_guildMgr = nullptr;
}
}

View file

@ -0,0 +1,58 @@
#ifndef RAGNAROK_SOURCE_CONTENTS_GUILDMGR_H
#define RAGNAROK_SOURCE_CONTENTS_GUILDMGR_H
#include <cstddef>
#include <cstdint>
#include <map>
#include <vector>
class CGuildEmblemReqBundle;
class CGuild {
public:
CGuild();
virtual ~CGuild();
/* 0004 */ int m_emblemVersion;
};
class CGuildMgr {
public:
CGuildMgr();
virtual ~CGuildMgr();
static bool Create();
static void Destroy();
int GetEmblemVersion(std::uint32_t guildId) const;
void SetEmblemVersion(std::uint32_t guildId, int version);
struct MemberData {
/* 0000 */ int unknown_0000[5];
};
/* 0004 */ bool m_initialized;
/* 0008 */ std::map<std::uint32_t, CGuild> m_guilds;
/* 0010 */ CGuildEmblemReqBundle* m_reqBundle;
/* 0014 */ std::map<int, MemberData> m_members;
/* 001C */ int unknown_001C[2];
/* 0024 */ std::vector<int> m_unknownVector;
/* 0030 */ int m_timeout;
};
extern CGuildMgr* g_guildMgr;
#if defined(_WIN32) && !defined(_WIN64)
static_assert(sizeof(CGuild) == 8);
static_assert(offsetof(CGuild, m_emblemVersion) == 0x04);
static_assert(sizeof(CGuildMgr) == 52);
static_assert(sizeof(CGuildMgr::MemberData) == 20);
static_assert(offsetof(CGuildMgr, m_initialized) == 0x04);
static_assert(offsetof(CGuildMgr, m_guilds) == 0x08);
static_assert(offsetof(CGuildMgr, m_reqBundle) == 0x10);
static_assert(offsetof(CGuildMgr, m_members) == 0x14);
static_assert(offsetof(CGuildMgr, unknown_001C) == 0x1C);
static_assert(offsetof(CGuildMgr, m_unknownVector) == 0x24);
static_assert(offsetof(CGuildMgr, m_timeout) == 0x30);
#endif
#endif

View file

@ -295,6 +295,8 @@
"Source/Contents/Ground/TerrainHeight.cpp": 4,
"Source/Contents/Ground/TerrainPicking.cpp": 4,
"Source/Contents/Ground/TerrainPlane.cpp": 4,
"Source/Contents/GuildEmblemState.cpp": 4,
"Source/Contents/GuildMgr.cpp": 4,
"Source/Contents/Hotkeys/EmotionHotkeys.cpp": 4,
"Source/Contents/Hotkeys/HotkeyInfo.cpp": 4,
"Source/Contents/Hotkeys/UserHotkeyMgr.cpp": 4,