Use field names instead of numbers for CDClient tables (#945)

This commit is contained in:
David Markowitz
2023-01-07 01:48:59 -08:00
committed by GitHub
parent a580e3a2f5
commit 8920cd1063
39 changed files with 488 additions and 450 deletions

View File

@@ -21,20 +21,20 @@ CDDestructibleComponentTable::CDDestructibleComponentTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM DestructibleComponent");
while (!tableData.eof()) {
CDDestructibleComponent entry;
entry.id = tableData.getIntField(0, -1);
entry.faction = tableData.getIntField(1, -1);
entry.factionList = tableData.getStringField(2, "");
entry.life = tableData.getIntField(3, -1);
entry.imagination = tableData.getIntField(4, -1);
entry.LootMatrixIndex = tableData.getIntField(5, -1);
entry.CurrencyIndex = tableData.getIntField(6, -1);
entry.level = tableData.getIntField(7, -1);
entry.armor = tableData.getFloatField(8, -1.0f);
entry.death_behavior = tableData.getIntField(9, -1);
entry.isnpc = tableData.getIntField(10, -1) == 1 ? true : false;
entry.attack_priority = tableData.getIntField(11, -1);
entry.isSmashable = tableData.getIntField(12, -1) == 1 ? true : false;
entry.difficultyLevel = tableData.getIntField(13, -1);
entry.id = tableData.getIntField("id", -1);
entry.faction = tableData.getIntField("faction", -1);
entry.factionList = tableData.getStringField("factionList", "");
entry.life = tableData.getIntField("life", -1);
entry.imagination = tableData.getIntField("imagination", -1);
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
entry.CurrencyIndex = tableData.getIntField("CurrencyIndex", -1);
entry.level = tableData.getIntField("level", -1);
entry.armor = tableData.getFloatField("armor", -1.0f);
entry.death_behavior = tableData.getIntField("death_behavior", -1);
entry.isnpc = tableData.getIntField("isnpc", -1) == 1 ? true : false;
entry.attack_priority = tableData.getIntField("attack_priority", -1);
entry.isSmashable = tableData.getIntField("isSmashable", -1) == 1 ? true : false;
entry.difficultyLevel = tableData.getIntField("difficultyLevel", -1);
this->entries.push_back(entry);
tableData.nextRow();
@@ -65,3 +65,4 @@ std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::fu
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::GetEntries(void) const {
return this->entries;
}