feat(db): load realm configs db

This commit is contained in:
fallenoak 2023-02-18 12:01:16 -06:00
parent 35f8ede70b
commit 84c1fecfb2
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
4 changed files with 58 additions and 0 deletions

View File

@ -3,6 +3,7 @@
WowClientDB<AchievementRec> g_achievementDB;
WowClientDB<Cfg_CategoriesRec> g_cfg_CategoriesDB;
WowClientDB<Cfg_ConfigsRec> g_cfg_ConfigsDB;
void LoadDB(WowClientDB_Base* db, const char* filename, int32_t linenumber) {
db->Load(filename, linenumber);
@ -11,6 +12,7 @@ void LoadDB(WowClientDB_Base* db, const char* filename, int32_t linenumber) {
void StaticDBLoadAll(void (*loadFn)(WowClientDB_Base*, const char*, int32_t)) {
loadFn(&g_achievementDB, __FILE__, __LINE__);
loadFn(&g_cfg_CategoriesDB, __FILE__, __LINE__);
loadFn(&g_cfg_ConfigsDB, __FILE__, __LINE__);
};
void ClientDBInitialize() {

View File

@ -3,10 +3,12 @@
#include "db/rec/AchievementRec.hpp"
#include "db/rec/Cfg_CategoriesRec.hpp"
#include "db/rec/Cfg_ConfigsRec.hpp"
#include "db/WowClientDB.hpp"
extern WowClientDB<AchievementRec> g_achievementDB;
extern WowClientDB<Cfg_CategoriesRec> g_cfg_CategoriesDB;
extern WowClientDB<Cfg_ConfigsRec> g_cfg_ConfigsDB;
void ClientDBInitialize();

View File

@ -0,0 +1,31 @@
#include "db/rec/Cfg_ConfigsRec.hpp"
#include "util/SFile.hpp"
const char* Cfg_ConfigsRec::GetFilename() {
return "DBFilesClient\\Cfg_Configs.dbc";
}
uint32_t Cfg_ConfigsRec::GetNumColumns() {
return 4;
}
uint32_t Cfg_ConfigsRec::GetRowSize() {
return 16;
}
int32_t Cfg_ConfigsRec::GetID() {
return this->m_ID;
}
bool Cfg_ConfigsRec::Read(SFile* f, const char* stringBuffer) {
if (
!SFile::Read(f, &this->m_ID, sizeof(this->m_ID), nullptr, nullptr, nullptr)
|| !SFile::Read(f, &this->m_realmType, sizeof(this->m_realmType), nullptr, nullptr, nullptr)
|| !SFile::Read(f, &this->m_playerKillingAllowed, sizeof(this->m_playerKillingAllowed), nullptr, nullptr, nullptr)
|| !SFile::Read(f, &this->m_roleplaying, sizeof(this->m_roleplaying), nullptr, nullptr, nullptr)
) {
return false;
}
return true;
}

View File

@ -0,0 +1,23 @@
#ifndef DB_REC_CFG_CONFIGS_REC_HPP
#define DB_REC_CFG_CONFIGS_REC_HPP
#include <cstdint>
class SFile;
class Cfg_ConfigsRec {
public:
int32_t m_ID;
int32_t m_realmType;
int32_t m_playerKillingAllowed;
int32_t m_roleplaying;
static const char* GetFilename();
static uint32_t GetNumColumns();
static uint32_t GetRowSize();
int32_t GetID();
bool Read(SFile* f, const char* stringBuffer);
};
#endif