idk man, I let it churn

This commit is contained in:
Aronwk
2025-08-31 13:22:21 -05:00
parent 9ff8134de8
commit 0760c76288
11 changed files with 466 additions and 27 deletions

View File

@@ -20,6 +20,13 @@ void CDComponentsRegistryTable::LoadValuesFromDatabase() {
tableData.finalize();
}
void CDComponentsRegistryTable::LoadValuesFromDefaults() {
// Provide minimal mappings for tests: no components for default template IDs.
auto& entries = GetEntriesMutable();
// Ensure a default empty mapping for template id 0 (used in some tests)
entries.insert_or_assign(0, 0);
}
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
auto& entries = GetEntriesMutable();
auto exists = entries.find(id);

View File

@@ -16,5 +16,6 @@ struct CDComponentsRegistry {
class CDComponentsRegistryTable : public CDTable<CDComponentsRegistryTable, std::unordered_map<uint64_t, uint32_t>> {
public:
void LoadValuesFromDatabase();
void LoadValuesFromDefaults();
int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0);
};

View File

@@ -50,4 +50,19 @@ namespace CDZoneTableTable {
return nullptr;
}
void LoadValuesFromDefaults() {
// Provide a minimal default zone entry so zone-dependent startup paths don't crash during tests.
CDZoneTable defaultZone{};
defaultZone.zoneID = 1;
defaultZone.zoneName = "testzone";
defaultZone.zoneControlTemplate = 2365;
defaultZone.ghostdistance_min = 100.0f;
defaultZone.ghostdistance = 100.0f;
defaultZone.PlayerLoseCoinsOnDeath = false;
defaultZone.disableSaveLoc = false;
defaultZone.mountsAllowed = false;
defaultZone.petsAllowed = false;
entries[defaultZone.zoneID] = defaultZone;
}
}

View File

@@ -36,6 +36,7 @@ struct CDZoneTable {
namespace CDZoneTableTable {
using Table = std::map<uint32_t, CDZoneTable>;
void LoadValuesFromDatabase();
void LoadValuesFromDefaults();
// Queries the table with a zoneID to find.
const CDZoneTable* Query(uint32_t zoneID);