Moved the character's stats into their own database table
This will allow the to be reused elsewhere, as well as cleaning up big blocks of code in the manager's source. BUGFIX: The config's key-value pair overrides now work without requiring a config file specification.
This commit is contained in:
@@ -41,12 +41,14 @@ void ConfigUtility::Load(std::string fname, int argc, char* argv[]) {
|
||||
table_t redirectedFile;
|
||||
table_t cmdLineParams;
|
||||
char key[256], val[256];
|
||||
bool redirectUsed = false;
|
||||
|
||||
//reading from the command line
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
//read from a specified config file
|
||||
if (!strncmp(argv[i], "-config=", 8)) {
|
||||
redirectedFile = Read(argv[i] + 8);
|
||||
redirectUsed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -70,6 +72,9 @@ void ConfigUtility::Load(std::string fname, int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
//finally, construct the final config table
|
||||
if (!redirectUsed) {
|
||||
redirectedFile = Read(fname);
|
||||
}
|
||||
configMap.insert(cmdLineParams.begin(), cmdLineParams.end());
|
||||
configMap.insert(redirectedFile.begin(), redirectedFile.end());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user