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

@@ -18,33 +18,33 @@ CDZoneTableTable::CDZoneTableTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ZoneTable");
while (!tableData.eof()) {
CDZoneTable entry;
entry.zoneID = tableData.getIntField(0, -1);
entry.locStatus = tableData.getIntField(1, -1);
entry.zoneName = tableData.getStringField(2, "");
entry.scriptID = tableData.getIntField(3, -1);
entry.ghostdistance_min = tableData.getFloatField(4, -1.0f);
entry.ghostdistance = tableData.getFloatField(5, -1.0f);
entry.population_soft_cap = tableData.getIntField(6, -1);
entry.population_hard_cap = tableData.getIntField(7, -1);
UNUSED(entry.DisplayDescription = tableData.getStringField(8, ""));
UNUSED(entry.mapFolder = tableData.getStringField(9, ""));
entry.smashableMinDistance = tableData.getFloatField(10, -1.0f);
entry.smashableMaxDistance = tableData.getFloatField(11, -1.0f);
UNUSED(entry.mixerProgram = tableData.getStringField(12, ""));
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField(13, ""));
UNUSED(entry.serverPhysicsFramerate = tableData.getStringField(14, ""));
entry.zoneControlTemplate = tableData.getIntField(15, -1);
entry.widthInChunks = tableData.getIntField(16, -1);
entry.heightInChunks = tableData.getIntField(17, -1);
entry.petsAllowed = tableData.getIntField(18, -1) == 1 ? true : false;
entry.localize = tableData.getIntField(19, -1) == 1 ? true : false;
entry.fZoneWeight = tableData.getFloatField(20, -1.0f);
UNUSED(entry.thumbnail = tableData.getStringField(21, ""));
entry.PlayerLoseCoinsOnDeath = tableData.getIntField(22, -1) == 1 ? true : false;
UNUSED(entry.disableSaveLoc = tableData.getIntField(23, -1) == 1 ? true : false);
entry.teamRadius = tableData.getFloatField(24, -1.0f);
UNUSED(entry.gate_version = tableData.getStringField(25, ""));
UNUSED(entry.mountsAllowed = tableData.getIntField(26, -1) == 1 ? true : false);
entry.zoneID = tableData.getIntField("zoneID", -1);
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.zoneName = tableData.getStringField("zoneName", "");
entry.scriptID = tableData.getIntField("scriptID", -1);
entry.ghostdistance_min = tableData.getFloatField("ghostdistance_min", -1.0f);
entry.ghostdistance = tableData.getFloatField("ghostdistance", -1.0f);
entry.population_soft_cap = tableData.getIntField("population_soft_cap", -1);
entry.population_hard_cap = tableData.getIntField("population_hard_cap", -1);
UNUSED(entry.DisplayDescription = tableData.getStringField("DisplayDescription", ""));
UNUSED(entry.mapFolder = tableData.getStringField("mapFolder", ""));
entry.smashableMinDistance = tableData.getFloatField("smashableMinDistance", -1.0f);
entry.smashableMaxDistance = tableData.getFloatField("smashableMaxDistance", -1.0f);
UNUSED(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
UNUSED(entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", ""));
entry.zoneControlTemplate = tableData.getIntField("zoneControlTemplate", -1);
entry.widthInChunks = tableData.getIntField("widthInChunks", -1);
entry.heightInChunks = tableData.getIntField("heightInChunks", -1);
entry.petsAllowed = tableData.getIntField("petsAllowed", -1) == 1 ? true : false;
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
entry.fZoneWeight = tableData.getFloatField("fZoneWeight", -1.0f);
UNUSED(entry.thumbnail = tableData.getStringField("thumbnail", ""));
entry.PlayerLoseCoinsOnDeath = tableData.getIntField("PlayerLoseCoinsOnDeath", -1) == 1 ? true : false;
UNUSED(entry.disableSaveLoc = tableData.getIntField("disableSaveLoc", -1) == 1 ? true : false);
entry.teamRadius = tableData.getFloatField("teamRadius", -1.0f);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.mountsAllowed = tableData.getIntField("mountsAllowed", -1) == 1 ? true : false);
this->m_Entries.insert(std::make_pair(entry.zoneID, entry));
tableData.nextRow();
@@ -71,3 +71,4 @@ const CDZoneTable* CDZoneTableTable::Query(unsigned int zoneID) {
return nullptr;
}