diff --git a/src/db/Db.cpp b/src/db/Db.cpp index 7485e1c..f45d3ea 100644 --- a/src/db/Db.cpp +++ b/src/db/Db.cpp @@ -3,6 +3,7 @@ WowClientDB g_achievementDB; WowClientDB g_cfg_CategoriesDB; +WowClientDB 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() { diff --git a/src/db/Db.hpp b/src/db/Db.hpp index 13bee54..3cefd02 100644 --- a/src/db/Db.hpp +++ b/src/db/Db.hpp @@ -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 g_achievementDB; extern WowClientDB g_cfg_CategoriesDB; +extern WowClientDB g_cfg_ConfigsDB; void ClientDBInitialize(); diff --git a/src/db/rec/Cfg_ConfigsRec.cpp b/src/db/rec/Cfg_ConfigsRec.cpp new file mode 100644 index 0000000..a66c57e --- /dev/null +++ b/src/db/rec/Cfg_ConfigsRec.cpp @@ -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; +} diff --git a/src/db/rec/Cfg_ConfigsRec.hpp b/src/db/rec/Cfg_ConfigsRec.hpp new file mode 100644 index 0000000..6fb8856 --- /dev/null +++ b/src/db/rec/Cfg_ConfigsRec.hpp @@ -0,0 +1,23 @@ +#ifndef DB_REC_CFG_CONFIGS_REC_HPP +#define DB_REC_CFG_CONFIGS_REC_HPP + +#include + +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