mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-05 23:08:31 +00:00
Fix component tests to work without database dependencies
Co-authored-by: aronwk-aaron <26027722+aronwk-aaron@users.noreply.github.com>
This commit is contained in:
@@ -51,3 +51,13 @@ int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponent
|
||||
|
||||
return iter == entries.end() ? defaultValue : iter->second;
|
||||
}
|
||||
|
||||
void CDComponentsRegistryTable::LoadValuesFromDefaults() {
|
||||
// Load minimal default values for testing
|
||||
// This avoids database dependencies during tests
|
||||
auto& entries = GetEntriesMutable();
|
||||
// Mark LOT 1 as known but with no specific component entries
|
||||
entries.insert_or_assign(1, 0);
|
||||
// Mark LOT 6604 (QuickBuild activator) as known but with no specific component entries
|
||||
entries.insert_or_assign(6604, 0);
|
||||
}
|
||||
|
@@ -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);
|
||||
};
|
||||
|
Reference in New Issue
Block a user