mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-06 07:18:42 +00:00
idk man, I let it churn
This commit is contained in:
@@ -153,6 +153,10 @@ void CDClientManager::LoadValuesFromDatabase() {
|
||||
|
||||
void CDClientManager::LoadValuesFromDefaults() {
|
||||
LOG("Loading default CDClient tables!");
|
||||
|
||||
// Only call table default loaders that actually exist. Tests don't need
|
||||
// the full CDClient database; add additional table default loaders here
|
||||
// if/when those tables implement LoadValuesFromDefaults().
|
||||
CDPetComponentTable::Instance().LoadValuesFromDefaults();
|
||||
CDComponentsRegistryTable::Instance().LoadValuesFromDefaults();
|
||||
CDZoneTableTable::LoadValuesFromDefaults();
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
};
|
||||
|
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user