Initial work on shared memory hotfixes

This commit is contained in:
KimLS
2015-06-23 17:39:06 -07:00
parent 32e880f571
commit 67143f1b8a
23 changed files with 266 additions and 185 deletions
+41 -26
View File
@@ -26,6 +26,7 @@
#include "../common/crash.h"
#include "../common/rulesys.h"
#include "../common/eqemu_exception.h"
#include "../common/string_util.h"
#include "items.h"
#include "npc_faction.h"
#include "loot.h"
@@ -61,6 +62,7 @@ int main(int argc, char **argv) {
database.LoadLogSettings(Log.log_settings);
Log.StartFileLogs();
std::string hotfix_name = "";
bool load_all = true;
bool load_items = false;
bool load_factions = false;
@@ -69,112 +71,125 @@ int main(int argc, char **argv) {
bool load_spells = false;
bool load_bd = false;
if(argc > 1) {
load_all = false;
for(int i = 1; i < argc; ++i) {
switch(argv[i][0]) {
case 'a':
if(strcasecmp("all", argv[i]) == 0) {
load_all = true;
}
break;
switch(argv[i][0]) {
case 'b':
if(strcasecmp("base_data", argv[i]) == 0) {
load_bd = true;
load_all = false;
}
break;
case 'i':
if(strcasecmp("items", argv[i]) == 0) {
load_items = true;
load_all = false;
}
break;
case 'f':
if(strcasecmp("factions", argv[i]) == 0) {
load_factions = true;
load_all = false;
}
break;
case 'l':
if(strcasecmp("loot", argv[i]) == 0) {
load_loot = true;
load_all = false;
}
break;
case 's':
if(strcasecmp("skill_caps", argv[i]) == 0) {
load_skill_caps = true;
load_all = false;
} else if(strcasecmp("spells", argv[i]) == 0) {
load_spells = true;
load_all = false;
}
break;
case '-': {
auto split = SplitString(argv[i], '=');
if(split.size() >= 2) {
auto command = split[0];
auto argument = split[1];
if(strcasecmp("-hotfix", command.c_str()) == 0) {
hotfix_name = argument;
load_all = true;
}
}
break;
}
}
}
}
if(hotfix_name.length() > 0) {
Log.Out(Logs::General, Logs::Status, "Writing data for hotfix '%s'", hotfix_name.c_str());
}
if(load_all || load_items) {
Log.Out(Logs::General, Logs::Status, "Loading items...");
try {
LoadItems(&database);
LoadItems(&database, hotfix_name);
} catch(std::exception &ex) {
Log.Out(Logs::General, Logs::Error, "%s", ex.what());
return 1;
}
}
if(load_all || load_factions) {
Log.Out(Logs::General, Logs::Status, "Loading factions...");
try {
LoadFactions(&database);
LoadFactions(&database, hotfix_name);
} catch(std::exception &ex) {
Log.Out(Logs::General, Logs::Error, "%s", ex.what());
return 1;
}
}
if(load_all || load_loot) {
Log.Out(Logs::General, Logs::Status, "Loading loot...");
try {
LoadLoot(&database);
LoadLoot(&database, hotfix_name);
} catch(std::exception &ex) {
Log.Out(Logs::General, Logs::Error, "%s", ex.what());
return 1;
}
}
if(load_all || load_skill_caps) {
Log.Out(Logs::General, Logs::Status, "Loading skill caps...");
try {
LoadSkillCaps(&database);
LoadSkillCaps(&database, hotfix_name);
} catch(std::exception &ex) {
Log.Out(Logs::General, Logs::Error, "%s", ex.what());
return 1;
}
}
if(load_all || load_spells) {
Log.Out(Logs::General, Logs::Status, "Loading spells...");
try {
LoadSpells(&database);
LoadSpells(&database, hotfix_name);
} catch(std::exception &ex) {
Log.Out(Logs::General, Logs::Error, "%s", ex.what());
return 1;
}
}
if(load_all || load_bd) {
Log.Out(Logs::General, Logs::Status, "Loading base data...");
try {
LoadBaseData(&database);
LoadBaseData(&database, hotfix_name);
} catch(std::exception &ex) {
Log.Out(Logs::General, Logs::Error, "%s", ex.what());
return 1;
}
}
Log.CloseFileLogs();
return 0;
}