Skip to content

Commit

Permalink
Modified to support config changes, and added back in config file init.
Browse files Browse the repository at this point in the history
(based on commit d80538e)

Signed-off-by: Xfurry <xfurry@scriptdev2.com>
  • Loading branch information
spkansas authored and xfurry committed Oct 30, 2015
1 parent 743fef8 commit 83878fa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/scriptdev2/ScriptMgr.cpp
Expand Up @@ -100,7 +100,27 @@ void InitScriptLibrary()
outstring_log(" MMM MMM http://www.scriptdev2.com");
outstring_log("");

// Load database (must be called after SD2Config.SetSource).
// Get configuration file
bool configFailure = false;
if (!SD2Config.SetSource(_MANGOSD_CONFIG))
configFailure = true;
else
outstring_log("SD2: Using configuration file %s", _MANGOSD_CONFIG);

// Set SD2 Error Log File
std::string sd2LogFile = SD2Config.GetStringDefault("SD2ErrorLogFile", "SD2Errors.log");
setScriptLibraryErrorFile(sd2LogFile.c_str(), "SD2");

if (configFailure)
script_error_log("Unable to open configuration file. Database will be unaccessible. Configuration values will use default.");

// Check config file version
if (SD2Config.GetIntDefault("ConfVersion", 0) != _MANGOSDCONFVERSION)
script_error_log("Configuration file version doesn't match expected version. Some config variables may be wrong or missing.");

outstring_log("");

// Load database (must be called after SD2Config.SetSource).
LoadDatabase();

outstring_log("SD2: Loading C++ scripts");
Expand Down
2 changes: 1 addition & 1 deletion src/scriptdev2/system/system.cpp
Expand Up @@ -42,7 +42,7 @@ void SystemMgr::LoadVersion()
if (strSD2Version.empty())
strSD2Version.append("ScriptDev2 ");

strSD2Version.append(_FULLVERSION);
strSD2Version.append(_FULLSD2VERSION);

outstring_log("Loading %s", strSD2Version.c_str());
outstring_log("");
Expand Down

0 comments on commit 83878fa

Please sign in to comment.