feat(glue): initialize realm list

This commit is contained in:
fallenoak 2023-02-14 23:23:09 -06:00
parent ef834d938e
commit 780de91468
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
4 changed files with 36 additions and 2 deletions

View File

@ -243,8 +243,7 @@ void CGlueMgr::Initialize() {
CGlueMgr::Resume();
// TODO
// CRealmList::Initialize();
CRealmList::Initialize();
EventRegisterEx(EVENT_ID_IDLE, &CGlueMgr::Idle, 0, 0.0);

View File

@ -12,6 +12,7 @@ target_include_directories(glue
target_link_libraries(glue
PRIVATE
client
db
event
gx
net

View File

@ -1,4 +1,23 @@
#include "glue/CRealmList.hpp"
#include "db/Db.hpp"
#include <storm/Memory.hpp>
TSFixedArray<RealmCategory*> CRealmList::s_categories;
void CRealmList::Initialize() {
CRealmList::s_categories.SetCount(g_cfg_CategoriesDB.m_numRecords);
for (int32_t i = 0; i < g_cfg_CategoriesDB.m_numRecords; i++) {
auto m = SMemAlloc(sizeof(RealmCategory), __FILE__, __LINE__, 0x0);
auto category = new (m) RealmCategory();
CRealmList::s_categories[i] = category;
CRealmList::s_categories[i]->m_category = g_cfg_CategoriesDB.GetRecordByIndex(i);
CRealmList::s_categories[i]->uint14 = 0;
}
// TODO Initialize CRealmList::s_sortCriteria
}
void CRealmList::UpdateList() {
// TODO

View File

@ -1,9 +1,24 @@
#ifndef GLUE_C_REALM_LIST_HPP
#define GLUE_C_REALM_LIST_HPP
#include <cstdint>
#include <storm/Array.hpp>
class Cfg_CategoriesRec;
struct RealmCategory {
Cfg_CategoriesRec* m_category;
TSGrowableArray<uint32_t> m_realms;
uint32_t uint14;
};
class CRealmList {
public:
// Static variables
static TSFixedArray<RealmCategory*> s_categories;
// Static functions
static void Initialize();
static void UpdateList();
};