rodecomp/Source/UI/Cooldowns/CooldownOwner.cpp
ragnarok-clanker a887f8976d Confirm fn_20961 (DestroyCooldownOwner)
Batch #18226 by eAthena: 1 byte-identical, 0 confirmed by peer review.

- fn_20961 DestroyCooldownOwner: byte-identical (already on main)

Merged automatically: every function is byte-identical to the original.
2026-11-12 11:10:34 +00:00

75 lines
1.6 KiB
C++

#include "UI/Cooldowns/CooldownOwner.h"
// INLINED
CooldownOwner::CooldownOwner() {
this->m_initialized = false;
this->m_drawing.normal.clear();
this->m_drawing.reverse.clear();
this->m_values.clear();
this->m_initialized = true;
}
// INLINED
CooldownOwner::~CooldownOwner() {
this->m_drawing.normal.clear();
this->m_drawing.reverse.clear();
this->m_values.clear();
}
// OFFSET: 0x00CA61A0
// FUNCTION: fn_20957
void CooldownOwner::Register(unsigned id, std::uint32_t duration, std::uint32_t start, std::uint32_t elapsed) {
this->Remove(id);
this->m_values.insert(std::make_pair(id, CooldownState(0, 0, 0, duration, start, elapsed, 1)));
}
// OFFSET: 0x00CA64B0
// FUNCTION: fn_20959
void CooldownOwner::ClearReverseCommands() {
this->m_drawing.reverse.clear();
}
// INLINED
CooldownState* CooldownOwner::Find(unsigned id) {
const auto entry = this->m_values.find(id);
return entry == this->m_values.end() ? nullptr : &entry->second;
}
// INLINED
void CooldownOwner::Erase(unsigned id) {
this->m_values.erase(id);
}
// STATIC: 0x0171DD1C
// GLOBAL: gl_24487
CooldownOwner* g_cooldownOwner = nullptr;
// OFFSET: 0x00CA64C0
// FUNCTION: fn_20960
bool CreateCooldownOwner() {
if (g_cooldownOwner) {
return false;
}
g_cooldownOwner = new (std::nothrow) CooldownOwner;
if (!g_cooldownOwner) {
return false;
}
if (!g_cooldownOwner->m_initialized) {
delete g_cooldownOwner;
g_cooldownOwner = nullptr;
return false;
}
return true;
}
// OFFSET: 0x00CA6610
// FUNCTION: fn_20961
void DestroyCooldownOwner() {
if (g_cooldownOwner) {
delete g_cooldownOwner;
g_cooldownOwner = nullptr;
}
}