mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-26 07:23:34 +00:00
5eca25e42a
* Move away from constructor queries Fix up other large tables to have proper backup lookups Revert "idk im just dumb ig" This reverts commit 5d5be5df53b8959b42b291613d7db749a65a3585. idk im just dumb ig * Fix slow components registry lookup * add define for cdclient cache all * Update CDBehaviorParameterTable.cpp
36 lines
1.5 KiB
C++
36 lines
1.5 KiB
C++
#include "CDPhysicsComponentTable.h"
|
|
|
|
void CDPhysicsComponentTable::LoadValuesFromDatabase() {
|
|
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PhysicsComponent");
|
|
while (!tableData.eof()) {
|
|
CDPhysicsComponent entry;
|
|
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();
|
|
}
|
|
|
|
tableData.finalize();
|
|
}
|
|
|
|
CDPhysicsComponent* CDPhysicsComponentTable::GetByID(unsigned int componentID) {
|
|
auto itr = m_entries.find(componentID);
|
|
return itr != m_entries.end() ? &itr->second : nullptr;
|
|
}
|
|
|