mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-16 10:04:42 +03:00
feat(db): add getter for num records
This commit is contained in:
parent
9d83df95f9
commit
eed060e512
@ -18,8 +18,14 @@ class WowClientDB : public WowClientDB_Common<T>, IDatabase<T> {
|
||||
|
||||
// Member functions
|
||||
T* GetRecordByIndex(int32_t index) const;
|
||||
int32_t GetNumRecords();
|
||||
};
|
||||
|
||||
template <class T>
|
||||
int32_t WowClientDB<T>::GetNumRecords() {
|
||||
return this->m_numRecords;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T* WowClientDB<T>::GetRecordByIndex(int32_t index) const {
|
||||
STORM_ASSERT(this->m_numRecords >= 0);
|
||||
|
@ -12,9 +12,9 @@ int32_t CRealmList::s_preferredCategory = -1;
|
||||
int32_t CRealmList::s_selectedCategory = -1;
|
||||
|
||||
void CRealmList::Initialize() {
|
||||
CRealmList::s_categories.SetCount(g_cfg_CategoriesDB.m_numRecords);
|
||||
CRealmList::s_categories.SetCount(g_cfg_CategoriesDB.GetNumRecords());
|
||||
|
||||
for (int32_t i = 0; i < g_cfg_CategoriesDB.m_numRecords; i++) {
|
||||
for (int32_t i = 0; i < g_cfg_CategoriesDB.GetNumRecords(); i++) {
|
||||
auto m = SMemAlloc(sizeof(RealmCategory), __FILE__, __LINE__, 0x0);
|
||||
auto category = new (m) RealmCategory();
|
||||
|
||||
|
@ -215,7 +215,7 @@ int32_t Script_GetServerName(lua_State* L) {
|
||||
auto down = true;
|
||||
|
||||
if (selectedRealm) {
|
||||
for (int32_t i = 0; i < g_cfg_ConfigsDB.m_numRecords; i++) {
|
||||
for (int32_t i = 0; i < g_cfg_ConfigsDB.GetNumRecords(); i++) {
|
||||
auto config = g_cfg_ConfigsDB.GetRecordByIndex(i);
|
||||
|
||||
if (config->m_realmType == selectedRealm->type) {
|
||||
|
@ -137,7 +137,7 @@ int32_t Script_GetRealmInfo(lua_State* L) {
|
||||
int32_t realmIsPvp = 0;
|
||||
int32_t realmIsRp = 0;
|
||||
|
||||
for (int32_t i = 0; i < g_cfg_ConfigsDB.m_numRecords; i++) {
|
||||
for (int32_t i = 0; i < g_cfg_ConfigsDB.GetNumRecords(); i++) {
|
||||
auto config = g_cfg_ConfigsDB.GetRecordByIndex(i);
|
||||
|
||||
if (config->m_realmType == realmInfo->type) {
|
||||
|
Loading…
Reference in New Issue
Block a user