Merge pull request #795 from noudess/master

Fix the LoadGFG function to no longer have the unused parameter.
This commit is contained in:
Michael Cook (mackal) 2018-12-11 17:20:48 -05:00 committed by GitHub
commit ce5c09441f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 25 deletions

2
zone/command.cpp Normal file → Executable file
View File

@ -1688,7 +1688,7 @@ void command_zheader(Client *c, const Seperator *sep)
c->Message(0, "Invalid Zone Name: %s", sep->argplus[1]); c->Message(0, "Invalid Zone Name: %s", sep->argplus[1]);
else { 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]); c->Message(0, "Successfully loaded zone header for %s from database.", sep->argplus[1]);
else else
c->Message(0, "Failed to load zone header %s from database", sep->argplus[1]); c->Message(0, "Failed to load zone header %s from database", sep->argplus[1]);

39
zone/zone.cpp Normal file → Executable file
View File

@ -893,7 +893,7 @@ bool Zone::Init(bool iStaticZone) {
SetStaticZone(iStaticZone); SetStaticZone(iStaticZone);
//load the zone config file. //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 LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults
if(RuleManager::Instance()->GetActiveRulesetID() != default_ruleset) if(RuleManager::Instance()->GetActiveRulesetID() != default_ruleset)
@ -1054,39 +1054,31 @@ void Zone::ReloadStaticData() {
zone->LoadNPCEmotes(&NPCEmoteList); zone->LoadNPCEmotes(&NPCEmoteList);
//load the zone config file. //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 LoadZoneCFG(zone->GetFileName(), zone->GetInstanceVersion()); // if that fails, try the file name, then load defaults
Log(Logs::General, Logs::Status, "Zone Static Data Reloaded."); 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)); 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 loading a non-zero instance failed, try loading the default
if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, if (instance_id != 0)
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))
{ {
safe_delete_array(map_name); safe_delete_array(map_name);
if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, if(!database.GetZoneCFG(database.GetZoneID(filename), 0, &newzone_data, can_bind, can_combat, can_levitate,
can_combat, can_levitate, can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name)) can_castoutdoor, is_city, is_hotzone, allow_mercs, zone_type, default_ruleset, &map_name))
{ {
Log(Logs::General, Logs::Error, "Error loading the Zone Config."); Log(Logs::General, Logs::Error, "Error loading the Zone Config.");
return false; return false;
} }
} }
} }
@ -1274,7 +1266,8 @@ bool Zone::Process() {
} }
} }
if(Weather_Timer->Check()){ if(Weather_Timer->Check())
{
Weather_Timer->Disable(); Weather_Timer->Disable();
this->ChangeWeather(); this->ChangeWeather();
} }

2
zone/zone.h Normal file → Executable file
View File

@ -93,7 +93,7 @@ public:
bool is_zone_time_localized; bool is_zone_time_localized;
bool Init(bool iStaticZone); 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 SaveZoneCFG();
bool IsLoaded(); bool IsLoaded();
bool IsPVPZone() { return pvpzone; } bool IsPVPZone() { return pvpzone; }