mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-19 03:20:11 +03:00
feat(db): improve accuracy of db records
This commit is contained in:
parent
41554f32b4
commit
57db9ca2a5
@ -101,9 +101,9 @@ void WowClientDB<T>::Load(const char* filename, int32_t linenumber) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (columnCount != T::columnCount) {
|
||||
if (columnCount != T::GetNumColumns()) {
|
||||
// TODO
|
||||
// SErrDisplayAppFatalCustom(0x85100079, "%s has wrong number of columns (found %i, expected %i)", T::GetFilename(), columnCount, T::columnCount);
|
||||
// SErrDisplayAppFatalCustom(0x85100079, "%s has wrong number of columns (found %i, expected %i)", T::GetFilename(), columnCount, T::GetNumColumns());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -114,9 +114,9 @@ void WowClientDB<T>::Load(const char* filename, int32_t linenumber) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rowSize != T::rowSize) {
|
||||
if (rowSize != T::GetRowSize()) {
|
||||
// TODO
|
||||
// SErrDisplayAppFatalCustom(0x85100079, "%s has wrong row size (found %i, expected %i)", T::GetFilename(), rowSize, T::rowSize);
|
||||
// SErrDisplayAppFatalCustom(0x85100079, "%s has wrong row size (found %i, expected %i)", T::GetFilename(), rowSize, T::GetRowSize());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -153,8 +153,8 @@ void WowClientDB<T>::LoadRecords(SFile* f, const char* filename, int32_t linenum
|
||||
auto record = &this->m_records[i];
|
||||
record->Read(f, this->m_strings);
|
||||
|
||||
this->m_maxID = record->m_ID > this->m_maxID ? record->m_ID : this->m_maxID;
|
||||
this->m_minID = record->m_ID < this->m_minID ? record->m_ID : this->m_minID;
|
||||
this->m_maxID = record->GetID() > this->m_maxID ? record->GetID() : this->m_maxID;
|
||||
this->m_minID = record->GetID() < this->m_minID ? record->GetID() : this->m_minID;
|
||||
}
|
||||
|
||||
auto recordsById = SMemAlloc(sizeof(void*) * (this->m_maxID - this->m_minID + 1), __FILE__, __LINE__, 0x0);
|
||||
@ -163,7 +163,7 @@ void WowClientDB<T>::LoadRecords(SFile* f, const char* filename, int32_t linenum
|
||||
|
||||
for (uint32_t i = 0; i < this->m_numRecords; i++) {
|
||||
auto record = &this->m_records[i];
|
||||
auto id = record->m_ID - this->m_minID;
|
||||
auto id = record->GetID() - this->m_minID;
|
||||
this->m_recordsById[id] = record;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,18 @@ const char* AchievementRec::GetFilename() {
|
||||
return "DBFilesClient\\Achievement.dbc";
|
||||
}
|
||||
|
||||
uint32_t AchievementRec::GetNumColumns() {
|
||||
return 62;
|
||||
}
|
||||
|
||||
uint32_t AchievementRec::GetRowSize() {
|
||||
return 248;
|
||||
}
|
||||
|
||||
int32_t AchievementRec::GetID() {
|
||||
return this->m_ID;
|
||||
}
|
||||
|
||||
bool AchievementRec::Read(SFile* f, const char* stringBuffer) {
|
||||
uint32_t titleOfs[16];
|
||||
uint32_t titleMask;
|
||||
|
@ -7,9 +7,6 @@ class SFile;
|
||||
|
||||
class AchievementRec {
|
||||
public:
|
||||
static constexpr uint32_t columnCount = 62;
|
||||
static constexpr uint32_t rowSize = 248;
|
||||
|
||||
int32_t m_ID;
|
||||
int32_t m_faction;
|
||||
int32_t m_instanceID;
|
||||
@ -20,12 +17,16 @@ class AchievementRec {
|
||||
int32_t m_points;
|
||||
int32_t m_uiOrder;
|
||||
int32_t m_flags;
|
||||
uint32_t m_iconID;
|
||||
int32_t m_iconID;
|
||||
const char* m_reward;
|
||||
int32_t m_minimumCriteria;
|
||||
int32_t m_sharesCriteria;
|
||||
|
||||
static const char* GetFilename();
|
||||
static uint32_t GetNumColumns();
|
||||
static uint32_t GetRowSize();
|
||||
|
||||
int32_t GetID();
|
||||
bool Read(SFile* f, const char* stringBuffer);
|
||||
};
|
||||
|
||||
|
@ -5,6 +5,18 @@ const char* Cfg_CategoriesRec::GetFilename() {
|
||||
return "DBFilesClient\\Cfg_Categories.dbc";
|
||||
}
|
||||
|
||||
uint32_t Cfg_CategoriesRec::GetNumColumns() {
|
||||
return 21;
|
||||
}
|
||||
|
||||
uint32_t Cfg_CategoriesRec::GetRowSize() {
|
||||
return 84;
|
||||
}
|
||||
|
||||
int32_t Cfg_CategoriesRec::GetID() {
|
||||
return this->m_ID;
|
||||
}
|
||||
|
||||
bool Cfg_CategoriesRec::Read(SFile* f, const char* stringBuffer) {
|
||||
uint32_t nameOfs[16];
|
||||
uint32_t nameMask;
|
||||
|
@ -7,16 +7,17 @@ class SFile;
|
||||
|
||||
class Cfg_CategoriesRec {
|
||||
public:
|
||||
static constexpr uint32_t columnCount = 21;
|
||||
static constexpr uint32_t rowSize = 84;
|
||||
|
||||
uint32_t m_ID;
|
||||
uint32_t m_localeMask;
|
||||
uint32_t m_createCharsetMask;
|
||||
uint32_t m_flags;
|
||||
int32_t m_ID;
|
||||
int32_t m_localeMask;
|
||||
int32_t m_createCharsetMask;
|
||||
int32_t m_flags;
|
||||
const char *m_name;
|
||||
|
||||
static const char* GetFilename();
|
||||
static uint32_t GetNumColumns();
|
||||
static uint32_t GetRowSize();
|
||||
|
||||
int32_t GetID();
|
||||
bool Read(SFile* f, const char* stringBuffer);
|
||||
};
|
||||
|
||||
|
@ -52,7 +52,7 @@ void CRealmList::UpdateList() {
|
||||
for (int32_t categoryIndex = 0; categoryIndex < CRealmList::s_categories.Count(); categoryIndex++) {
|
||||
auto realmCategory = CRealmList::s_categories[categoryIndex];
|
||||
|
||||
if (realmInfo->category != realmCategory->m_category->m_ID) {
|
||||
if (realmInfo->category != realmCategory->m_category->GetID()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ void CRealmList::UpdateList() {
|
||||
// TODO sort realm list
|
||||
|
||||
for (int32_t i = 0; i < CRealmList::s_categories.Count(); i++) {
|
||||
if (CRealmList::s_categories[i]->m_category->m_ID == category) {
|
||||
if (CRealmList::s_categories[i]->m_category->GetID() == category) {
|
||||
CRealmList::s_selectedCategory = i;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user