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

@@ -4,22 +4,22 @@ CDPhysicsComponentTable::CDPhysicsComponentTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PhysicsComponent");
while (!tableData.eof()) {
CDPhysicsComponent* entry = new CDPhysicsComponent();
entry->id = tableData.getIntField(0, -1);
entry->bStatic = tableData.getIntField(1, -1) != 0;
entry->physicsAsset = tableData.getStringField(2, "");
UNUSED(entry->jump = tableData.getIntField(3, -1) != 0);
UNUSED(entry->doublejump = tableData.getIntField(4, -1) != 0);
entry->speed = tableData.getFloatField(5, -1);
UNUSED(entry->rotSpeed = tableData.getFloatField(6, -1));
entry->playerHeight = tableData.getFloatField(7);
entry->playerRadius = tableData.getFloatField(8);
entry->pcShapeType = tableData.getIntField(9);
entry->collisionGroup = tableData.getIntField(10);
UNUSED(entry->airSpeed = tableData.getFloatField(11));
UNUSED(entry->boundaryAsset = tableData.getStringField(12));
UNUSED(entry->jumpAirSpeed = tableData.getFloatField(13));
UNUSED(entry->friction = tableData.getFloatField(14));
UNUSED(entry->gravityVolumeAsset = tableData.getStringField(15));
entry->id = tableData.getIntField("id", -1);
entry->bStatic = tableData.getIntField("static", -1) != 0;
entry->physicsAsset = tableData.getStringField("physics_asset", "");
UNUSED(entry->jump = tableData.getIntField("jump", -1) != 0);
UNUSED(entry->doublejump = tableData.getIntField("doublejump", -1) != 0);
entry->speed = tableData.getFloatField("speed", -1);
UNUSED(entry->rotSpeed = tableData.getFloatField("rotSpeed", -1));
entry->playerHeight = tableData.getFloatField("playerHeight");
entry->playerRadius = tableData.getFloatField("playerRadius");
entry->pcShapeType = tableData.getIntField("pcShapeType");
entry->collisionGroup = tableData.getIntField("collisionGroup");
UNUSED(entry->airSpeed = tableData.getFloatField("airSpeed"));
UNUSED(entry->boundaryAsset = tableData.getStringField("boundaryAsset"));
UNUSED(entry->jumpAirSpeed = tableData.getFloatField("jumpAirSpeed"));
UNUSED(entry->friction = tableData.getFloatField("friction"));
UNUSED(entry->gravityVolumeAsset = tableData.getStringField("gravityVolumeAsset"));
m_entries.insert(std::make_pair(entry->id, entry));
tableData.nextRow();
@@ -47,3 +47,4 @@ CDPhysicsComponent* CDPhysicsComponentTable::GetByID(unsigned int componentID) {
return nullptr;
}