[Hotfix] Fix database loading routines (#4030)

This commit is contained in:
Chris Miles
2024-01-29 00:14:33 -06:00
committed by GitHub
parent 2e0ed82986
commit bc59882a65
5 changed files with 26 additions and 62 deletions
+1 -12
View File
@@ -887,10 +887,6 @@ bool SpawnConditionManager::LoadSpawnConditions(const std::string& zone_short_na
)
);
if (conditions.empty()) {
return false;
}
for (const auto& e : conditions) {
SpawnCondition c;
@@ -919,10 +915,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const std::string& zone_short_na
)
);
if (condition_values.empty()) {
spawn_conditions.clear();
return false;
}
spawn_conditions.clear();
for (const auto& e : condition_values) {
auto i = spawn_conditions.find(e.id);
@@ -939,10 +932,6 @@ bool SpawnConditionManager::LoadSpawnConditions(const std::string& zone_short_na
)
);
if (events.empty()) {
return false;
}
LogInfo("Loaded [{}] spawn_events", Strings::Commify(std::to_string(events.size())));
for (const auto& e : events) {
+3 -3
View File
@@ -459,8 +459,8 @@ bool ZoneDatabase::LoadTraps(const std::string& zone_short_name, int16 instance_
}
for (const auto& e : l) {
if (e.group) {
if (entity_list.IsTrapGroupSpawned(e.id, e.group)) {
if (e.group_) {
if (entity_list.IsTrapGroupSpawned(e.id, e.group_)) {
// If a member of our group is already spawned skip loading this trap.
continue;
}
@@ -482,7 +482,7 @@ bool ZoneDatabase::LoadTraps(const std::string& zone_short_name, int16 instance_
t->respawn_time = e.respawn_time;
t->respawn_var = e.respawn_var;
t->level = e.level;
t->group = e.group;
t->group = e.group_;
t->triggered_number = e.triggered_number;
t->despawn_when_triggered = e.despawn_when_triggered;
t->undetectable = e.undetectable;
+8 -34
View File
@@ -1123,49 +1123,25 @@ bool Zone::Init(bool is_static) {
watermap = WaterMap::LoadWaterMapfile(map_name);
pathing = IPathfinder::Load(map_name);
if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) {
LogError("Loading spawn conditions failed, continuing without them");
}
spawn_conditions.LoadSpawnConditions(short_name, instanceid);
if (!content_db.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion())) {
LogError("Loading static zone points failed");
return false;
}
content_db.LoadStaticZonePoints(&zone_point_list, short_name, GetInstanceVersion());
if (!content_db.LoadSpawnGroups(short_name, GetInstanceVersion(), &spawn_group_list)) {
LogError("Loading spawn groups failed");
return false;
}
if (!content_db.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion()))
{
LogError("Loading spawn2 points failed");
return false;
}
content_db.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion());
database.LoadCharacterCorpses(zoneid, instanceid);
if (!database.LoadCharacterCorpses(zoneid, instanceid)) {
LogError("Loading player corpses failed");
return false;
}
if (!content_db.LoadTraps(short_name, GetInstanceVersion()))
{
LogError("Loading traps failed");
return false;
}
content_db.LoadTraps(short_name, GetInstanceVersion());
LogInfo("Loading adventure flavor text");
LoadAdventureFlavor();
if (!LoadGroundSpawns())
{
LogError("Loading ground spawns failed. continuing");
}
if (!LoadZoneObjects())
{
LogError("Loading World Objects failed. continuing");
}
LoadGroundSpawns();
LoadZoneObjects();
RespawnTimesRepository::ClearExpiredRespawnTimers(database);
@@ -1923,9 +1899,7 @@ void Zone::Repop()
LogError("Loading spawn groups failed");
}
if (!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) {
LogError("Loading spawn conditions failed, continuing without them");
}
spawn_conditions.LoadSpawnConditions(short_name, instanceid);
if (!content_db.PopulateZoneSpawnList(zoneid, spawn2_list, GetInstanceVersion())) {
LogDebug("Error in Zone::Repop: database.PopulateZoneSpawnList failed");