mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 03:02:30 +00:00
feat(db): load realm configs db
This commit is contained in:
parent
35f8ede70b
commit
84c1fecfb2
4 changed files with 58 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
WowClientDB<AchievementRec> g_achievementDB;
|
WowClientDB<AchievementRec> g_achievementDB;
|
||||||
WowClientDB<Cfg_CategoriesRec> g_cfg_CategoriesDB;
|
WowClientDB<Cfg_CategoriesRec> g_cfg_CategoriesDB;
|
||||||
|
WowClientDB<Cfg_ConfigsRec> g_cfg_ConfigsDB;
|
||||||
|
|
||||||
void LoadDB(WowClientDB_Base* db, const char* filename, int32_t linenumber) {
|
void LoadDB(WowClientDB_Base* db, const char* filename, int32_t linenumber) {
|
||||||
db->Load(filename, 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)) {
|
void StaticDBLoadAll(void (*loadFn)(WowClientDB_Base*, const char*, int32_t)) {
|
||||||
loadFn(&g_achievementDB, __FILE__, __LINE__);
|
loadFn(&g_achievementDB, __FILE__, __LINE__);
|
||||||
loadFn(&g_cfg_CategoriesDB, __FILE__, __LINE__);
|
loadFn(&g_cfg_CategoriesDB, __FILE__, __LINE__);
|
||||||
|
loadFn(&g_cfg_ConfigsDB, __FILE__, __LINE__);
|
||||||
};
|
};
|
||||||
|
|
||||||
void ClientDBInitialize() {
|
void ClientDBInitialize() {
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,12 @@
|
||||||
|
|
||||||
#include "db/rec/AchievementRec.hpp"
|
#include "db/rec/AchievementRec.hpp"
|
||||||
#include "db/rec/Cfg_CategoriesRec.hpp"
|
#include "db/rec/Cfg_CategoriesRec.hpp"
|
||||||
|
#include "db/rec/Cfg_ConfigsRec.hpp"
|
||||||
#include "db/WowClientDB.hpp"
|
#include "db/WowClientDB.hpp"
|
||||||
|
|
||||||
extern WowClientDB<AchievementRec> g_achievementDB;
|
extern WowClientDB<AchievementRec> g_achievementDB;
|
||||||
extern WowClientDB<Cfg_CategoriesRec> g_cfg_CategoriesDB;
|
extern WowClientDB<Cfg_CategoriesRec> g_cfg_CategoriesDB;
|
||||||
|
extern WowClientDB<Cfg_ConfigsRec> g_cfg_ConfigsDB;
|
||||||
|
|
||||||
void ClientDBInitialize();
|
void ClientDBInitialize();
|
||||||
|
|
||||||
|
|
|
||||||
31
src/db/rec/Cfg_ConfigsRec.cpp
Normal file
31
src/db/rec/Cfg_ConfigsRec.cpp
Normal 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;
|
||||||
|
}
|
||||||
23
src/db/rec/Cfg_ConfigsRec.hpp
Normal file
23
src/db/rec/Cfg_ConfigsRec.hpp
Normal 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue