Files
DarkflameServer/dDatabase/CDClientDatabase/CDClientTables/CDSceneTableTable.cpp
Aaron Kimbrell 6b7396546a refactor: look up the oldest zone files' scenes in a CDClient SceneTable table
Zone held a std::function that queried the SceneTable, so tests could swap it out. CDSceneTableTable now loads the table with the others, and Zone looks scenes up in it; tests fill its entries like the zone table's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 10:29:34 -05:00

29 lines
690 B
C++

#include "CDSceneTableTable.h"
namespace CDSceneTableTable {
Table entries;
void LoadValuesFromDatabase() {
// Get the data from the database
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM SceneTable");
while (!tableData.eof()) {
CDSceneTable entry;
entry.sceneID = tableData.getIntField("sceneID", -1);
entry.sceneName = tableData.getStringField("sceneName", "");
entries[entry.sceneID] = entry;
tableData.nextRow();
}
}
//! Queries the table with a sceneID to find.
const CDSceneTable* Query(uint32_t sceneID) {
const auto& iter = entries.find(sceneID);
if (iter != entries.end()) {
return &iter->second;
}
return nullptr;
}
}