Rewrite VarCache_Struct

Basically just remove manual memory management
This commit is contained in:
Michael Cook (mackal)
2016-05-09 14:23:27 -04:00
parent 59728c5115
commit c159b89e79
16 changed files with 146 additions and 239 deletions
+13 -13
View File
@@ -254,20 +254,20 @@ int main(int argc, char** argv) {
Log.Out(Logs::General, Logs::Zone_Server, "Mapping Incoming Opcodes");
MapOpcodes();
Log.Out(Logs::General, Logs::Zone_Server, "Loading Variables");
database.LoadVariables();
char hotfix_name[256] = { 0 };
if(database.GetVariable("hotfix_name", hotfix_name, 256)) {
if(strlen(hotfix_name) > 0) {
Log.Out(Logs::General, Logs::Zone_Server, "Current hotfix in use: '%s'", hotfix_name);
std::string hotfix_name;
if(database.GetVariable("hotfix_name", hotfix_name)) {
if(!hotfix_name.empty()) {
Log.Out(Logs::General, Logs::Zone_Server, "Current hotfix in use: '%s'", hotfix_name.c_str());
}
}
Log.Out(Logs::General, Logs::Zone_Server, "Loading zone names");
database.LoadZoneNames();
Log.Out(Logs::General, Logs::Zone_Server, "Loading items");
if(!database.LoadItems(hotfix_name)) {
Log.Out(Logs::General, Logs::Error, "Loading items FAILED!");
@@ -326,17 +326,17 @@ int main(int argc, char** argv) {
//rules:
{
char tmp[64];
if (database.GetVariable("RuleSet", tmp, sizeof(tmp)-1)) {
Log.Out(Logs::General, Logs::Zone_Server, "Loading rule set '%s'", tmp);
if(!RuleManager::Instance()->LoadRules(&database, tmp)) {
Log.Out(Logs::General, Logs::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp);
std::string tmp;
if (database.GetVariable("RuleSet", tmp)) {
Log.Out(Logs::General, Logs::Zone_Server, "Loading rule set '%s'", tmp.c_str());
if(!RuleManager::Instance()->LoadRules(&database, tmp.c_str())) {
Log.Out(Logs::General, Logs::Error, "Failed to load ruleset '%s', falling back to defaults.", tmp.c_str());
}
} else {
if(!RuleManager::Instance()->LoadRules(&database, "default")) {
Log.Out(Logs::General, Logs::Zone_Server, "No rule set configured, using default rules");
} else {
Log.Out(Logs::General, Logs::Zone_Server, "Loaded default rule set 'default'", tmp);
Log.Out(Logs::General, Logs::Zone_Server, "Loaded default rule set 'default'", tmp.c_str());
}
}
}