diff --git a/zone/command.cpp b/zone/command.cpp old mode 100644 new mode 100755 index 98faec71a..2a52b02d2 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -1688,7 +1688,7 @@ void command_zheader(Client *c, const Seperator *sep) c->Message(0, "Invalid Zone Name: %s", sep->argplus[1]); else { - if (zone->LoadZoneCFG(sep->argplus[1], true)) + if (zone->LoadZoneCFG(sep->argplus[1], 0)) c->Message(0, "Successfully loaded zone header for %s from database.", sep->argplus[1]); else c->Message(0, "Failed to load zone header %s from database", sep->argplus[1]); diff --git a/zone/zone.cpp b/zone/zone.cpp old mode 100644 new mode 100755 index 8fdd26fbf..f1fce52ac --- a/zone/zone.cpp +++ b/zone/zone.cpp @@ -893,7 +893,7 @@ bool Zone::Init(bool iStaticZone) { SetStaticZone(iStaticZone); //load the zone config file. - if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... + if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion())) // try loading the zone name... LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults if(RuleManager::Instance()->GetActiveRulesetID() != default_ruleset) @@ -1054,39 +1054,31 @@ void Zone::ReloadStaticData() { zone->LoadNPCEmotes(&NPCEmoteList); //load the zone config file. - if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion(), true)) // try loading the zone name... + if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion())) // try loading the zone name... LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults Log(Logs::General, Logs::Status, "Zone Static Data Reloaded."); } -bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault) +bool Zone::LoadZoneCFG(const char* filename, uint16 instance_id) { + memset(&newzone_data, 0, sizeof(NewZone_Struct)); - if(instance_id == 0) + map_name = nullptr; + + if(!database.GetZoneCFG(database.GetZoneID(filename), instance_id, &newzone_data, can_bind, + can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) { - map_name = nullptr; - if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, - can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) - { - Log(Logs::General, Logs::Error, "Error loading the Zone Config."); - return false; - } - } - else - { - //Fall back to base zone if we don't find the instance version. - map_name = nullptr; - if(!database.GetZoneCFG(database.GetZoneID(filename), instance_id, &newzone_data, can_bind, - can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) + // If loading a non-zero instance failed, try loading the default + if (instance_id != 0) { safe_delete_array(map_name); - if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, - can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) - { + if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate, + can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) + { Log(Logs::General, Logs::Error, "Error loading the Zone Config."); return false; - } + } } } @@ -1274,7 +1266,8 @@ bool Zone::Process() { } } - if(Weather_Timer->Check()){ + if(Weather_Timer->Check()) + { Weather_Timer->Disable(); this->ChangeWeather(); } diff --git a/zone/zone.h b/zone/zone.h old mode 100644 new mode 100755 index 5f8651d8b..ae0d93332 --- a/zone/zone.h +++ b/zone/zone.h @@ -93,7 +93,7 @@ public: bool is_zone_time_localized; bool Init(bool iStaticZone); - bool LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault = false); + bool LoadZoneCFG(const char* filename, uint16 instance_id); bool SaveZoneCFG(); bool IsLoaded(); bool IsPVPZone() { return pvpzone; }