diff --git a/mk/windows/vs2019-64/g3d_viewer.vcxproj b/mk/windows/vs2019-64/g3d_viewer.vcxproj
index a61aac65b..86ac658d0 100644
--- a/mk/windows/vs2019-64/g3d_viewer.vcxproj
+++ b/mk/windows/vs2019-64/g3d_viewer.vcxproj
@@ -255,7 +255,7 @@
Fast
true
4996
- Full
+ MaxSpeed
AnySuitable
true
Speed
diff --git a/mk/windows/vs2019-64/glest.vcxproj b/mk/windows/vs2019-64/glest.vcxproj
index ab10f7010..9b162d3d5 100644
--- a/mk/windows/vs2019-64/glest.vcxproj
+++ b/mk/windows/vs2019-64/glest.vcxproj
@@ -378,7 +378,7 @@
%(AdditionalOptions)
- Full
+ MaxSpeed
AnySuitable
true
Speed
diff --git a/mk/windows/vs2019-64/libglest.vcxproj b/mk/windows/vs2019-64/libglest.vcxproj
index c4c314650..443764ec4 100644
--- a/mk/windows/vs2019-64/libglest.vcxproj
+++ b/mk/windows/vs2019-64/libglest.vcxproj
@@ -282,7 +282,7 @@
%(AdditionalOptions)
- Full
+ MaxSpeed
AnySuitable
true
Speed
diff --git a/source/g3d_viewer/renderer.cpp b/source/g3d_viewer/renderer.cpp
index 8c8f67953..0a43c3c19 100644
--- a/source/g3d_viewer/renderer.cpp
+++ b/source/g3d_viewer/renderer.cpp
@@ -164,7 +164,7 @@ namespace Shared {
}
Config &config = Config::getInstance();
- if (config.getBool("CheckGlCaps")) {
+ if (config.getBool("CheckGlCaps", "true")) {
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
diff --git a/source/game/ai/ai_interface.cpp b/source/game/ai/ai_interface.cpp
index 98cb3f191..7aa2f949e 100644
--- a/source/game/ai/ai_interface.cpp
+++ b/source/game/ai/ai_interface.cpp
@@ -297,8 +297,8 @@ namespace Game {
ai.init(this, useStartLocation);
//config
- logLevel = Config::getInstance().getInt("AiLog");
- redir = Config::getInstance().getBool("AiRedir");
+ logLevel = Config::getInstance().getInt("AiLog", "0");
+ redir = Config::getInstance().getBool("AiRedir", "false");
aiLogFile = getLogFilename();
if (getGameReadWritePath(GameConstants::path_logs_CacheLookupKey) !=
diff --git a/source/game/game/console.cpp b/source/game/game/console.cpp
index fce3cb7ab..c0b67935f 100644
--- a/source/game/game/console.cpp
+++ b/source/game/game/console.cpp
@@ -44,10 +44,10 @@ namespace Game {
getFontCallbackName
(), this);
- maxLines = Config::getInstance().getInt("ConsoleMaxLines");
+ maxLines = Config::getInstance().getInt("ConsoleMaxLines", "6");
maxStoredLines =
- Config::getInstance().getInt("ConsoleMaxLinesStored");
- timeout = Config::getInstance().getInt("ConsoleTimeout");
+ Config::getInstance().getInt("ConsoleMaxLinesStored", "20");
+ timeout = Config::getInstance().getInt("ConsoleTimeout", "20");
timeElapsed = 0.0f;
xPos = 20;
yPos = 20;
diff --git a/source/game/game/game.cpp b/source/game/game/game.cpp
index 1e7b1cc32..00d84411e 100644
--- a/source/game/game/game.cpp
+++ b/source/game/game/game.cpp
@@ -3784,7 +3784,7 @@ namespace Game {
// END - Handle joining in progress games
//update auto test
- if (Config::getInstance().getBool("AutoTest")) {
+ if (Config::getInstance().getBool("AutoTest", "false")) {
AutoTest::getInstance().updateGame(this);
return;
}
@@ -6517,13 +6517,11 @@ namespace Game {
StrSound *gameMusic =
world.getThisFaction()->getType()->getMusic();
if (gameMusic != NULL) {
- float
- configVolume = (config.getInt("SoundVolumeMusic") / 100.f);
+ float configVolume = (config.getInt("SoundVolumeMusic", "70") / 100.f);
float currentVolume = gameMusic->getVolume();
if (currentVolume > 0) {
gameMusic->setVolume(0);
- console.addLine(lang.getString("GameMusic") +
- " " + lang.getString("Off"));
+ console.addLine(lang.getString("GameMusic") + " " + lang.getString("Off"));
} else {
//If the config says zero, use the default music volume
gameMusic->setVolume(configVolume ? configVolume : 0.9);
@@ -6893,7 +6891,7 @@ namespace Game {
}
//printf("Check savegame\n");
//printf("Saving...\n");
- if (Config::getInstance().getBool("AutoTest")) {
+ if (Config::getInstance().getBool("AutoTest", "false")) {
this->saveGame(GameConstants::saveGameFileAutoTestDefault);
}
@@ -7186,7 +7184,7 @@ namespace Game {
}
if ((game != NULL && game->isMasterserverMode() == true) ||
- Config::getInstance().getBool("AutoTest") == true) {
+ Config::getInstance().getBool("AutoTest", "false") == true) {
printf("Game ending with stats:\n");
printf("-----------------------\n");
diff --git a/source/game/game/game_camera.cpp b/source/game/game/game_camera.cpp
index d1d11041d..652c3c9de 100644
--- a/source/game/game/game_camera.cpp
+++ b/source/game/game/game_camera.cpp
@@ -79,7 +79,7 @@ namespace Game {
speed =
Config::getInstance().getFloat("CameraMoveSpeed",
"15") / GameConstants::cameraFps;
- clampBounds = !Config::getInstance().getBool("PhotoMode");
+ clampBounds = !Config::getInstance().getBool("PhotoMode", "false");
clampDisable = false;
vAng = startingVAng;
diff --git a/source/game/global/config.cpp b/source/game/global/config.cpp
index 2bd8f4aa1..d0dbe7902 100644
--- a/source/game/global/config.cpp
+++ b/source/game/global/config.cpp
@@ -30,6 +30,11 @@
#include
#include "leak_dumper.h"
+#ifdef WIN32
+#include
+#include "Shlobj.h"
+#endif
+
using namespace Shared::Platform;
using namespace Shared::Util;
using namespace std;
@@ -160,6 +165,12 @@ namespace Game {
file.second = linuxPath + file.second;
wasFound = true;
}
+ nixFile = linuxPath + "linux_" + file.second;
+ if (wasFound == false && fileExists(nixFile) == true) {
+ file.first = linuxPath + file.first;
+ file.second = nixFile;
+ wasFound = true;
+ }
#elif defined(__WIN32__)
string winFile = linuxPath + "windows_" + file.first;
if (SystemFlags::VERBOSE_MODE_ENABLED)
@@ -172,20 +183,32 @@ namespace Game {
file.second = linuxPath + file.second;
wasFound = true;
}
+ winFile = linuxPath + "windows_" + file.second;
+ if (wasFound == false && fileExists(winFile) == true) {
+ file.first = linuxPath + file.first;
+ file.second = winFile;
+ wasFound = true;
+ }
#endif
- if (wasFound == false && fileExists(linuxPath + file.first) == true) {
- file.first = linuxPath + file.first;
+ string realPath = linuxPath + file.first;
+ if (wasFound == false && fileExists(realPath) == true) {
+ file.first = realPath;
file.second = linuxPath + file.second;
wasFound = true;
}
+ realPath = linuxPath + file.second;
+ if (wasFound == false && fileExists(realPath) == true) {
+ file.first = linuxPath + file.first;
+ file.second = realPath;
+ wasFound = true;
+ }
}
return wasFound;
}
Config::Config(std::pair < ConfigType, ConfigType > type,
- std::pair < string, string > file, std::pair < bool,
- bool > fileMustExist, string custom_path) {
+ std::pair < string, string > file, string custom_path) {
fileLoaded.first = false;
fileLoaded.second = false;
cfgType = type;
@@ -210,19 +233,39 @@ namespace Game {
}
if (foundPath == false) {
- currentpath =
- extractDirectoryPathFromFile(Properties::getApplicationPath());
+ currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath());
foundPath = tryCustomPath(cfgType, fileName, currentpath);
}
-#if defined(DATADIR)
+#ifdef _WIN32
+ if (foundPath == false) {
+ char* env = getenv("APPDATA");
+ if (env != NULL) {
+ currentpath = env;
+ foundPath = tryCustomPath(cfgType, fileName, endPathWithSlash(currentpath));
+ }
+ }
+ if (foundPath == false) {
+ PWSTR path = NULL;
+ // Get path for each computer, non-user specific and non-roaming data.
+ if (SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &path) != S_OK) {
+ if (path != NULL) {
+ currentpath = *path;
+ foundPath = tryCustomPath(cfgType, fileName, endPathWithSlash(currentpath));
+ CoTaskMemFree(path);
+ }
+ }
+ }
+#endif
+
+#ifdef DATADIR
if (foundPath == false) {
foundPath = tryCustomPath(cfgType, fileName, endPathWithSlash(formatPath(TOSTRING(DATADIR))));
}
#endif
// Look in standard linux shared paths for ini files
-#if defined(__linux__)
+#ifdef __linux__
if (foundPath == false)
foundPath = tryCustomPath(cfgType, fileName, "/usr/share/glest/");
if (foundPath == false)
@@ -256,9 +299,8 @@ namespace Game {
if (SystemFlags::VERBOSE_MODE_ENABLED)
printf("foundPath = [%d]\n", foundPath);
- if (fileMustExist.first == true && fileExists(fileName.first) == false) {
- //string currentpath = extractDirectoryPathFromFile(Properties::getApplicationPath());
- fileName.first = currentpath + fileName.first;
+ if (!fileExists(fileName.first) && fileExists(fileName.second)) {
+ fileName.first = fileName.second;
}
#if defined(WIN32)
@@ -271,9 +313,7 @@ namespace Game {
printf("-=-=-=-=-=-=-= About to load fileName.first = [%s]\n",
fileName.first.c_str());
- if (fileMustExist.first == true ||
- (fileMustExist.first == false
- && fileExists(fileName.first) == true)) {
+ if (fileExists(fileName.first)) {
properties.first.load(fileName.first);
fileLoaded.first = true;
}
@@ -300,13 +340,13 @@ namespace Game {
} else if (cfgType.first == cfgMainKeys) {
Config & mainCfg = Config::getInstance();
if (mainCfg.hasString("UserData_Root")) {
- string userData = mainCfg.getString("UserData_Root");
+ string userData = mainCfg.getString("UserData_Root", "");
if (userData != "") {
endPathWithSlash(userData);
}
fileName.second = userData + fileNameParameter.second;
} else if (mainCfg.hasString("UserOverrideFile")) {
- string userData = mainCfg.getString("UserOverrideFile");
+ string userData = mainCfg.getString("UserOverrideFile", "");
if (userData != "") {
endPathWithSlash(userData);
}
@@ -323,9 +363,7 @@ namespace Game {
printf("-=-=-=-=-=-=-= About to load fileName.second = [%s]\n",
fileName.second.c_str());
- if (fileMustExist.second == true ||
- (fileMustExist.second == false
- && fileExists(fileName.second) == true)) {
+ if (fileName.first != fileName.second && fileExists(fileName.second)) {
properties.second.load(fileName.second);
fileLoaded.second = true;
}
@@ -371,9 +409,7 @@ namespace Game {
}
Config & Config::getInstance(std::pair < ConfigType, ConfigType > type,
- std::pair < string, string > file,
- std::pair < bool, bool > fileMustExist,
- string custom_path) {
+ std::pair < string, string > file, string custom_path) {
if (configList.find(type.first) == configList.end()) {
if (SystemFlags::VERBOSE_MODE_ENABLED)
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).
@@ -382,7 +418,7 @@ namespace Game {
"In [%s::%s Line: %d]\n", __FILE__,
__FUNCTION__, __LINE__);
- Config config(type, file, fileMustExist, custom_path);
+ Config config(type, file, custom_path);
if (SystemFlags::VERBOSE_MODE_ENABLED)
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).
@@ -424,10 +460,8 @@ namespace Game {
std::pair < ConfigType, ConfigType > type =
std::make_pair(cfgType.first, cfgType.second);
- Config newconfig(type,
- std::make_pair(fileNameParameter.first,
- fileNameParameter.second),
- std::make_pair(true, false), custom_path_parameter);
+ Config newconfig(type, std::make_pair(fileNameParameter.first,
+ fileNameParameter.second), custom_path_parameter);
if (SystemFlags::VERBOSE_MODE_ENABLED)
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).
@@ -569,7 +603,7 @@ namespace Game {
}
const bool Config::hasString(const char *key) const {
- return getString(key).length() != 0;
+ return getString(key, "").length() != 0;
}
SDL_Keycode Config::translateStringToSDLKey(const string & value) const {
diff --git a/source/game/global/config.h b/source/game/global/config.h
index 541208c33..4d04bdc1b 100644
--- a/source/game/global/config.h
+++ b/source/game/global/config.h
@@ -82,8 +82,7 @@ namespace Game {
Config();
Config(std::pair < ConfigType, ConfigType > type, std::pair < string,
- string > file, std::pair < bool, bool > fileMustExist,
- string custom_path = "");
+ string > file, string custom_path = "");
bool tryCustomPath(std::pair < ConfigType, ConfigType > &type,
std::pair < string, string > &file,
string custom_path);
@@ -102,48 +101,34 @@ namespace Game {
std::pair < string, string > file =
std::make_pair(glest_ini_filename,
glestuser_ini_filename),
- std::pair < bool, bool > fileMustExist =
- std::make_pair(true, false),
string custom_path = "");
void save(const string & path = "");
void reload();
- int getInt(const string & key, const char *defaultValueIfNotFound =
- NULL) const;
- bool getBool(const string & key, const char *defaultValueIfNotFound =
- NULL) const;
- float getFloat(const string & key, const char *defaultValueIfNotFound =
- NULL) const;
- const string getString(const string & key,
- const char *defaultValueIfNotFound =
- NULL) const;
+ int getInt(const string & key, const char *defaultValueIfNotFound/* = NULL*/) const;
+ bool getBool(const string & key, const char *defaultValueIfNotFound/* = NULL*/) const;
+ float getFloat(const string & key, const char *defaultValueIfNotFound/* = NULL*/) const;
+ const string getString(const string & key, const char *defaultValueIfNotFound/* = NULL*/) const;
- int getInt(const char *key, const char *defaultValueIfNotFound =
- NULL) const;
- bool getBool(const char *key, const char *defaultValueIfNotFound =
- NULL) const;
- float getFloat(const char *key, const char *defaultValueIfNotFound =
- NULL) const;
- const string getString(const char *key, const char *defaultValueIfNotFound = "") const;
+ int getInt(const char *key, const char *defaultValueIfNotFound/* = NULL*/) const;
+ bool getBool(const char *key, const char *defaultValueIfNotFound/* = NULL*/) const;
+ float getFloat(const char *key, const char *defaultValueIfNotFound/* = NULL*/) const;
+ const string getString(const char *key, const char *defaultValueIfNotFound/* = ""*/) const;
const bool hasString(const char *key) const;
//char getCharKey(const char *key) const;
SDL_Keycode getSDLKey(const char *key) const;
void setInt(const string & key, int value, bool tempBuffer = false);
void setBool(const string & key, bool value, bool tempBuffer = false);
- void setFloat(const string & key, float value, bool tempBuffer =
- false);
- void setString(const string & key, const string & value,
- bool tempBuffer = false);
+ void setFloat(const string & key, float value, bool tempBuffer = false);
+ void setString(const string & key, const string & value, bool tempBuffer = false);
- vector < string > getPathListForType(PathType type,
- string scenarioDir = "");
+ vector getPathListForType(PathType type, string scenarioDir = "");
- vector < pair < string, string > >getMergedProperties() const;
- vector < pair < string, string > >getMasterProperties() const;
- vector < pair < string, string > >getUserProperties() const;
- void setUserProperties(const vector < pair < string,
- string > >&valueList);
+ vector> getMergedProperties() const;
+ vector> getMasterProperties() const;
+ vector> getUserProperties() const;
+ void setUserProperties(const vector>& valueList);
string getFileName(bool userFilename) const;
diff --git a/source/game/global/core_data.cpp b/source/game/global/core_data.cpp
index d483fd6d3..e38b71345 100644
--- a/source/game/global/core_data.cpp
+++ b/source/game/global/core_data.cpp
@@ -1148,10 +1148,10 @@ namespace Game {
//display font
Config & config = Config::getInstance();
- string displayFontNamePrefix = config.getString("FontDisplayPrefix");
- string displayFontNamePostfix = config.getString("FontDisplayPostfix");
+ string displayFontNamePrefix = config.getString("FontDisplayPrefix", "*-arial-*-r-*-*-");
+ string displayFontNamePostfix = config.getString("FontDisplayPostfix", "-*-*-*-*-*-*-*");
int displayFontSize =
- computeFontSize(config.getInt("FontDisplayBaseSize"));
+ computeFontSize(config.getInt("FontDisplayBaseSize", "12"));
if (lang.hasString("FontDisplayPrefix") == true) {
displayFontNamePrefix = lang.getString("FontDisplayPrefix");
@@ -1185,11 +1185,11 @@ namespace Game {
//menu fonts
string displayFontNameSmallPrefix =
- config.getString("FontDisplayPrefix");
+ config.getString("FontDisplayPrefix", "*-arial-*-r-*-*-");
string displayFontNameSmallPostfix =
- config.getString("FontDisplayPostfix");
+ config.getString("FontDisplayPostfix", "-*-*-*-*-*-*-*");
int displayFontNameSmallSize =
- computeFontSize(config.getInt("FontDisplaySmallBaseSize"));
+ computeFontSize(config.getInt("FontDisplaySmallBaseSize", "12"));
if (lang.hasString("FontDisplayPrefix") == true) {
displayFontNameSmallPrefix = lang.getString("FontDisplayPrefix");
@@ -1224,11 +1224,11 @@ namespace Game {
displayFontNameSmallSize);
string menuFontNameNormalPrefix =
- config.getString("FontMenuNormalPrefix");
+ config.getString("FontMenuNormalPrefix", "-*-arial-*-r-*-*-");
string menuFontNameNormalPostfix =
- config.getString("FontMenuNormalPostfix");
+ config.getString("FontMenuNormalPostfix", "-*-*-*-*-*-*-*");
int menuFontNameNormalSize =
- computeFontSize(config.getInt("FontMenuNormalBaseSize"));
+ computeFontSize(config.getInt("FontMenuNormalBaseSize", "14"));
if (lang.hasString("FontMenuNormalPrefix") == true) {
menuFontNameNormalPrefix = lang.getString("FontMenuNormalPrefix");
}
@@ -1261,10 +1261,10 @@ namespace Game {
menuFontNameNormal.c_str(),
menuFontNameNormalSize);
- string menuFontNameBigPrefix = config.getString("FontMenuBigPrefix");
- string menuFontNameBigPostfix = config.getString("FontMenuBigPostfix");
+ string menuFontNameBigPrefix = config.getString("FontMenuBigPrefix", "-*-arial-*-r-*-*-");
+ string menuFontNameBigPostfix = config.getString("FontMenuBigPostfix", "-*-*-*-*-*-*-*");
int menuFontNameBigSize =
- computeFontSize(config.getInt("FontMenuBigBaseSize"));
+ computeFontSize(config.getInt("FontMenuBigBaseSize", "20"));
if (lang.hasString("FontMenuBigPrefix") == true) {
menuFontNameBigPrefix = lang.getString("FontMenuBigPrefix");
@@ -1298,11 +1298,11 @@ namespace Game {
menuFontNameBigSize);
string menuFontNameVeryBigPrefix =
- config.getString("FontMenuBigPrefix");
+ config.getString("FontMenuBigPrefix", "-*-arial-*-r-*-*-");
string menuFontNameVeryBigPostfix =
- config.getString("FontMenuBigPostfix");
+ config.getString("FontMenuBigPostfix", "-*-*-*-*-*-*-*");
int menuFontNameVeryBigSize =
- computeFontSize(config.getInt("FontMenuVeryBigBaseSize"));
+ computeFontSize(config.getInt("FontMenuVeryBigBaseSize", "25"));
if (lang.hasString("FontMenuBigPrefix") == true) {
menuFontNameVeryBigPrefix = lang.getString("FontMenuBigPrefix");
@@ -1337,10 +1337,10 @@ namespace Game {
menuFontNameVeryBigSize);
//console font
- string consoleFontNamePrefix = config.getString("FontConsolePrefix");
- string consoleFontNamePostfix = config.getString("FontConsolePostfix");
+ string consoleFontNamePrefix = config.getString("FontConsolePrefix", "-*-arial-*-r-*-*-");
+ string consoleFontNamePostfix = config.getString("FontConsolePostfix", "-*-*-*-*-*-*-*");
int consoleFontNameSize =
- computeFontSize(config.getInt("FontConsoleBaseSize"));
+ computeFontSize(config.getInt("FontConsoleBaseSize", "18"));
if (lang.hasString("FontConsolePrefix") == true) {
consoleFontNamePrefix = lang.getString("FontConsolePrefix");
@@ -1409,11 +1409,11 @@ namespace Game {
int rs = size;
Config & config = Config::getInstance();
if (Font::forceLegacyFonts == true) {
- int screenH = config.getInt("ScreenHeight");
+ int screenH = config.getInt("ScreenHeight", "768");
rs = size * screenH / 1024;
}
//FontSizeAdjustment
- rs += config.getInt("FontSizeAdjustment");
+ rs += config.getInt("FontSizeAdjustment", "0");
if (Font::forceLegacyFonts == false) {
rs += Font::baseSize; //basesize only for new font system
}
diff --git a/source/game/global/metrics.cpp b/source/game/global/metrics.cpp
index 0d83a67c0..263c3e2d1 100644
--- a/source/game/global/metrics.cpp
+++ b/source/game/global/metrics.cpp
@@ -47,12 +47,12 @@ namespace Game {
if (resWidth > 0) {
screenW = resWidth;
} else {
- screenW = config.getInt("ScreenWidth");
+ screenW = config.getInt("ScreenWidth", "1024");
}
if (resHeight > 0) {
screenH = resHeight;
} else {
- screenH = config.getInt("ScreenHeight");
+ screenH = config.getInt("ScreenHeight", "768");
}
minimapX = 10;
diff --git a/source/game/graphics/renderer.cpp b/source/game/graphics/renderer.cpp
index 0076f747d..ed83c6416 100644
--- a/source/game/graphics/renderer.cpp
+++ b/source/game/graphics/renderer.cpp
@@ -176,13 +176,13 @@ namespace Game {
Renderer::perspFarPlane = config.getFloat("PerspectiveFarPlane", floatToStr(Renderer::perspFarPlane).c_str());
this->no2DMouseRendering = config.getBool("No2DMouseRendering", "false");
- this->maxConsoleLines = config.getInt("ConsoleMaxLines");
+ this->maxConsoleLines = config.getInt("ConsoleMaxLines", "6");
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Renderer::perspFarPlane [%f] this->no2DMouseRendering [%d] this->maxConsoleLines [%d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, Renderer::perspFarPlane, this->no2DMouseRendering, this->maxConsoleLines);
GraphicsInterface &gi = GraphicsInterface::getInstance();
FactoryRepository &fr = FactoryRepository::getInstance();
- gi.setFactory(fr.getGraphicsFactory(config.getString("FactoryGraphics")));
+ gi.setFactory(fr.getGraphicsFactory(config.getString("FactoryGraphics", "OpenGL")));
GraphicsFactory *graphicsFactory = GraphicsInterface::getInstance().getFactory();
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
@@ -364,7 +364,7 @@ namespace Game {
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
- if (config.getBool("CheckGlCaps")) {
+ if (config.getBool("CheckGlCaps", "true")) {
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
@@ -379,10 +379,10 @@ namespace Game {
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
- if (config.getBool("FirstTime")) {
+ if (config.getBool("FirstTime", "false")) {
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
- config.setBool("FirstTime", false);
+ config.setBool("FirstTime", "false");
autoConfig();
if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
@@ -5639,7 +5639,7 @@ namespace Game {
return;
}
- if (config.getBool("PhotoMode")) {
+ if (config.getBool("PhotoMode", "false")) {
return;
}
@@ -7474,10 +7474,10 @@ namespace Game {
Config &config = Config::getInstance();
//cache most used config params
- maxLights = config.getInt("MaxLights");
- photoMode = config.getBool("PhotoMode");
- focusArrows = config.getBool("FocusArrows");
- textures3D = config.getBool("Textures3D");
+ maxLights = config.getInt("MaxLights", "8");
+ photoMode = config.getBool("PhotoMode", "false");
+ focusArrows = config.getBool("FocusArrows", "true");
+ textures3D = config.getBool("Textures3D", "true");
float gammaValue = config.getFloat("GammaValue", "0.0");
if (this->program == NULL) {
throw game_runtime_error("this->program == NULL");
@@ -7490,16 +7490,16 @@ namespace Game {
//}
}
//load shadows
- shadows = strToShadows(config.getString("Shadows"));
+ shadows = strToShadows(config.getString("Shadows", "Projected"));
if (shadows == sProjected || shadows == sShadowMapping) {
- shadowTextureSize = config.getInt("ShadowTextureSize");
- shadowFrameSkip = config.getInt("ShadowFrameSkip");
+ shadowTextureSize = config.getInt("ShadowTextureSize", "512");
+ shadowFrameSkip = config.getInt("ShadowFrameSkip", "2");
shadowIntensity = config.getFloat("ShadowIntensity", "1.0");
}
//load filter settings
- Texture2D::Filter textureFilter = strToTextureFilter(config.getString("Filter"));
- int maxAnisotropy = config.getInt("FilterMaxAnisotropy");
+ Texture2D::Filter textureFilter = strToTextureFilter(config.getString("Filter", "Bilinear"));
+ int maxAnisotropy = config.getInt("FilterMaxAnisotropy", "1");
if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
for (int i = 0; i < rsCount; ++i) {
@@ -9234,8 +9234,8 @@ namespace Game {
if (supportFBOs == true && renderToTexture != NULL) {
Config &config = Config::getInstance();
- Texture2D::Filter textureFilter = strToTextureFilter(config.getString("Filter"));
- int maxAnisotropy = config.getInt("FilterMaxAnisotropy");
+ Texture2D::Filter textureFilter = strToTextureFilter(config.getString("Filter", "Bilinear"));
+ int maxAnisotropy = config.getInt("FilterMaxAnisotropy", "1");
const Metrics &metrics = Metrics::getInstance();
@@ -9312,8 +9312,8 @@ namespace Game {
if (supportFBOs == true && renderToTexture != NULL) {
Config &config = Config::getInstance();
- Texture2D::Filter textureFilter = strToTextureFilter(config.getString("Filter"));
- int maxAnisotropy = config.getInt("FilterMaxAnisotropy");
+ Texture2D::Filter textureFilter = strToTextureFilter(config.getString("Filter", "Bilinear"));
+ int maxAnisotropy = config.getInt("FilterMaxAnisotropy", "1");
*renderToTexture = GraphicsInterface::getInstance().getFactory()->newTexture2D();
Texture2DGl *texture = static_cast(*renderToTexture);
diff --git a/source/game/main/intro.cpp b/source/game/main/intro.cpp
index 0efc8109e..c479d1487 100644
--- a/source/game/main/intro.cpp
+++ b/source/game/main/intro.cpp
@@ -669,7 +669,7 @@ namespace Game {
return;
}
- if (Config::getInstance().getBool("AutoTest")) {
+ if (Config::getInstance().getBool("AutoTest", "false")) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,
"In [%s::%s Line: %d]\n", __FILE__,
__FUNCTION__, __LINE__);
diff --git a/source/game/main/main.cpp b/source/game/main/main.cpp
index 931b01eec..c957d6b08 100644
--- a/source/game/main/main.cpp
+++ b/source/game/main/main.cpp
@@ -1108,12 +1108,12 @@ namespace Game {
int
MainWindow::getDesiredScreenWidth() {
Config & config = Config::getInstance();
- return config.getInt("ScreenWidth");
+ return config.getInt("ScreenWidth", "1024");
}
int
MainWindow::getDesiredScreenHeight() {
Config & config = Config::getInstance();
- return config.getInt("ScreenHeight");
+ return config.getInt("ScreenHeight", "768");
}
void
@@ -1125,8 +1125,8 @@ namespace Game {
this->program->getWindow()->getScreenHeight());
} else {
Config & config = Config::getInstance();
- Metrics::reload(config.getInt("ScreenWidth"),
- config.getInt("ScreenHeight"));
+ Metrics::reload(config.getInt("ScreenWidth", "1024"),
+ config.getInt("ScreenHeight", "768"));
//window->setText(config.getString("WindowTitle","Glest"));
//this->mainMenu->init();
}
@@ -6277,12 +6277,12 @@ namespace Game {
getGameCustomCoreDataPath(data_path_check, "");
if (data_path_check == userDataPath_check) {
printf
- ("****WARNING**** your game data path and user data path are the same.\nThis will likely create problems: %s\n",
+ ("*WARNING* your game data path and user data path are the same.\nThis will likely create problems: %s\n",
data_path_check.c_str());
- throw
+ /*throw
game_runtime_error
("Regular and User data paths cannot have the same value [" +
- userDataPath_check + "]");
+ userDataPath_check + "]");*/
}
if (userData != "") {
@@ -6442,7 +6442,7 @@ namespace Game {
if (hasCommandArgument
(argc, argv,
GAME_ARGS[GAME_ARG_DISABLE_OPENGL_CAPS_CHECK]) == true
- || config.getBool("CheckGlCaps") == false) {
+ || config.getBool("CheckGlCaps", "1") == false) {
printf("**WARNING** disabling opengl capability checking...\n");
config.setBool("CheckGlCaps", false, true);
}
@@ -6793,7 +6793,6 @@ namespace Game {
std::pair < string,
string >(Config::glestkeys_ini_filename,
Config::glestuserkeys_ini_filename),
- std::pair < bool, bool >(true, false),
config.getString("GlestKeysIniPath", ""));
SystemFlags::OutputDebug(SystemFlags::debugSystem,
@@ -6837,7 +6836,7 @@ namespace Game {
// Load the language strings
Lang & lang = Lang::getInstance();
string
- language = config.getString("Lang");
+ language = config.getString("Lang", "english");
if (hasCommandArgument(argc, argv, GAME_ARGS[GAME_ARG_USE_LANGUAGE])
== true) {
int
@@ -6979,8 +6978,7 @@ namespace Game {
if (lang.hasString("FONT_HEIGHT_TEXT")) {
::Shared::Graphics::Font::langHeightText =
- config.
- getString("FONT_HEIGHT_TEXT", ::Shared::Graphics::Font::
+ config.getString("FONT_HEIGHT_TEXT", ::Shared::Graphics::Font::
langHeightText.c_str());
}
diff --git a/source/game/main/program.cpp b/source/game/main/program.cpp
index 513f8c8a3..2a92af278 100644
--- a/source/game/main/program.cpp
+++ b/source/game/main/program.cpp
@@ -1238,11 +1238,11 @@ namespace Game {
//window
//window->setText("Glest");
- window->setStyle(config.getBool("Windowed") ? wsWindowedFixed :
+ window->setStyle(config.getBool("Windowed", "false") ? wsWindowedFixed :
wsFullscreen);
window->setPos(0, 0);
- window->setSize(config.getInt("ScreenWidth"),
- config.getInt("ScreenHeight"));
+ window->setSize(config.getInt("ScreenWidth", "1024"),
+ config.getInt("ScreenHeight", "768"));
window->create();
if (SystemFlags::
@@ -1316,9 +1316,9 @@ namespace Game {
(__FILE__).c_str(), __FUNCTION__,
__LINE__);
- window->initGl(config.getInt("ColorBits"),
- config.getInt("DepthBits"),
- config.getInt("StencilBits"),
+ window->initGl(config.getInt("ColorBits", "32"),
+ config.getInt("DepthBits", "16"),
+ config.getInt("StencilBits", "0"),
config.getBool("HardwareAcceleration", "true"),
config.getBool("FullScreenAntiAliasing", "0"),
config.getFloat("GammaValue", "0.0"));
@@ -1438,32 +1438,32 @@ namespace Game {
Config & config = Config::getInstance();
- if (!config.getBool("Windowed")) {
+ if (!config.getBool("Windowed", "false")) {
//int freq= config.getInt("RefreshFrequency");
int
- colorBits = config.getInt("ColorBits");
+ colorBits = config.getInt("ColorBits", "32");
int
- screenWidth = config.getInt("ScreenWidth");
+ screenWidth = config.getInt("ScreenWidth", "1024");
int
- screenHeight = config.getInt("ScreenHeight");
+ screenHeight = config.getInt("ScreenHeight", "768");
if (config.getBool("AutoMaxFullScreen", "false") == true) {
getFullscreenVideoInfo(colorBits, screenWidth, screenHeight,
- !config.getBool("Windowed"));
+ !config.getBool("Windowed", "false"));
config.setInt("ColorBits", colorBits);
config.setInt("ScreenWidth", screenWidth);
config.setInt("ScreenHeight", screenHeight);
}
}
- changeVideoModeFullScreen(!config.getBool("Windowed"));
+ changeVideoModeFullScreen(!config.getBool("Windowed", "false"));
}
void
Program::restoreDisplaySettings() {
Config & config = Config::getInstance();
- if (!config.getBool("Windowed")) {
+ if (!config.getBool("Windowed", "false")) {
restoreVideoMode(this->getWindow()->getSDLWindow());
}
}
diff --git a/source/game/menu/menu_state_connected_game.cpp b/source/game/menu/menu_state_connected_game.cpp
index 5b6447037..ed8dc25ce 100644
--- a/source/game/menu/menu_state_connected_game.cpp
+++ b/source/game/menu/menu_state_connected_game.cpp
@@ -2490,11 +2490,10 @@ namespace Game {
needToBroadcastServerSettings = true;
broadcastServerSettingsDelayTimer = time(NULL);
} else if (checkBoxAllowObservers.mouseClick(x, y)) {
-#ifdef DEBUG
- PRINT_DEBUG("In [%s::%s Line %d]\n",
- extractFileFromDirectoryPath(__FILE__).c_str(),
- __FUNCTION__, __LINE__);
-#endif
+ if (SystemFlags::VERBOSE_MODE_ENABLED)
+ printf("In [%s::%s Line %d]\n",
+ extractFileFromDirectoryPath(__FILE__).c_str(),
+ __FUNCTION__, __LINE__);
needToBroadcastServerSettings = true;
broadcastServerSettingsDelayTimer = time(NULL);
} else if (checkBoxEnableSwitchTeamMode.mouseClick(x, y)) {
@@ -2646,11 +2645,10 @@ namespace Game {
getGameSettings()->getStartLocationIndex
(clientInterface->getGameSettings()->getThisFactionIndex
()) != i && listBoxTeams[i].mouseClick(x, y)) {
-#ifdef DEBUG
- PRINT_DEBUG("In [%s::%s Line %d]\n",
- extractFileFromDirectoryPath(__FILE__).c_str(),
- __FUNCTION__, __LINE__);
-#endif
+ if (SystemFlags::VERBOSE_MODE_ENABLED)
+ printf("In [%s::%s Line %d]\n",
+ extractFileFromDirectoryPath(__FILE__).c_str(),
+ __FUNCTION__, __LINE__);
if (factionFiles[listBoxFactions[i].getSelectedItemIndex()] !=
formatString(GameConstants::OBSERVER_SLOTNAME)) {
if (listBoxTeams[i].getSelectedItemIndex() + 1 !=
diff --git a/source/game/menu/menu_state_custom_game.cpp b/source/game/menu/menu_state_custom_game.cpp
index f32582f2f..37fb9b20e 100644
--- a/source/game/menu/menu_state_custom_game.cpp
+++ b/source/game/menu/menu_state_custom_game.cpp
@@ -967,7 +967,7 @@ namespace Game {
ConfigType >(cfgMainKeys, cfgUserKeys));
console.addLine(lang.getString("ToSwitchOffMusicPress") + " - \"" +
- configKeys.getString("ToggleMusic") + "\"");
+ configKeys.getString("ToggleMusic", "K") + "\"");
chatManager.init(&console, -1, true);
@@ -1212,7 +1212,7 @@ namespace Game {
ConfigType >(cfgMainKeys, cfgUserKeys));
console.addLine(lang.getString("ToSwitchOffMusicPress") + " - \"" +
- configKeys.getString("ToggleMusic") + "\"");
+ configKeys.getString("ToggleMusic", "K") + "\"");
chatManager.init(&console, -1, true);
@@ -3506,7 +3506,7 @@ namespace Game {
//SoundRenderer &soundRenderer= SoundRenderer::getInstance();
//switch on music again!!
Config & config = Config::getInstance();
- float configVolume = (config.getInt("SoundVolumeMusic") / 100.f);
+ float configVolume = (config.getInt("SoundVolumeMusic", "70") / 100.f);
if (factionVideoSwitchedOffVolume) {
if (CoreData::getInstance().getMenuMusic()->getVolume() !=
configVolume) {
@@ -3760,7 +3760,7 @@ namespace Game {
extractFileFromDirectoryPath(__FILE__).
c_str(), __FUNCTION__, __LINE__);
- string request = Config::getInstance().getString("Masterserver");
+ string request = Config::getInstance().getString("Masterserver", "http://master.megaglest.org/");
if (request != "") {
endPathWithSlash(request, false);
}
@@ -5418,7 +5418,7 @@ namespace Game {
Config & config = Config::getInstance();
Lang & lang = Lang::getInstance();
- float configVolume = (config.getInt("SoundVolumeMusic") / 100.f);
+ float configVolume = (config.getInt("SoundVolumeMusic", "70") / 100.f);
float currentVolume =
CoreData::getInstance().getMenuMusic()->getVolume();
if (currentVolume > 0) {
diff --git a/source/game/menu/menu_state_custom_game_update.cpp b/source/game/menu/menu_state_custom_game_update.cpp
index f45ccdb40..054611b58 100644
--- a/source/game/menu/menu_state_custom_game_update.cpp
+++ b/source/game/menu/menu_state_custom_game_update.cpp
@@ -503,7 +503,7 @@ namespace Game {
labelNetStatus[i].setText(szBuf);
} else {
string port =
- "(" + intToStr(config.getInt("PortServer")) + ")";
+ "(" + intToStr(config.getInt("PortServer", "61357")) + ")";
labelNetStatus[i].setText("--- " + port);
}
} else {
@@ -792,7 +792,7 @@ namespace Game {
playFx(snd.getSound(snd.sfxAttention));
//switch on music again!!
Config & config = Config::getInstance();
- float configVolume = (config.getInt("SoundVolumeMusic") / 100.f);
+ float configVolume = (config.getInt("SoundVolumeMusic", "70") / 100.f);
CoreData::getInstance().getMenuMusic()->setVolume(configVolume);
}
soundConnectionCount = currentConnectionCount;
diff --git a/source/game/menu/menu_state_keysetup.cpp b/source/game/menu/menu_state_keysetup.cpp
index 429368959..c9b079621 100644
--- a/source/game/menu/menu_state_keysetup.cpp
+++ b/source/game/menu/menu_state_keysetup.cpp
@@ -436,7 +436,6 @@ namespace Game {
string >(Config::glestkeys_ini_filename,
Config::
glestuserkeys_ini_filename),
- std::pair < bool, bool >(true, false),
config.getString("GlestKeysIniPath", ""));
string userKeysFile = configKeys.getFileName(true);
if (SystemFlags::VERBOSE_MODE_ENABLED)
diff --git a/source/game/menu/menu_state_options.cpp b/source/game/menu/menu_state_options.cpp
index f9efd4263..d0b0589d9 100644
--- a/source/game/menu/menu_state_options.cpp
+++ b/source/game/menu/menu_state_options.cpp
@@ -208,9 +208,7 @@ namespace Game {
string,
string >
defaultLang =
- Lang::getInstance().getNativeNameFromLanguageName(config.
- getString
- ("Lang"));
+ Lang::getInstance().getNativeNameFromLanguageName(config.getString("Lang", "english"));
if (defaultLang.first == "" && defaultLang.second == "") {
defaultLang =
Lang::getInstance().
@@ -247,7 +245,7 @@ namespace Game {
listFontSizeAdjustment.pushBackItem(intToStr(i));
}
listFontSizeAdjustment.
- setSelectedItem(intToStr(config.getInt("FontSizeAdjustment")));
+ setSelectedItem(intToStr(config.getInt("FontSizeAdjustment", "0")));
currentLine -= lineOffset;
// Screenshot type flag
@@ -604,7 +602,7 @@ namespace Game {
soundRenderer.playFx(coreData.getClickSoundA());
string
- currentFontSizeAdjustment = config.getString("FontSizeAdjustment");
+ currentFontSizeAdjustment = config.getString("FontSizeAdjustment", "0");
string
selectedFontSizeAdjustment =
listFontSizeAdjustment.getSelectedItem();
@@ -681,7 +679,7 @@ namespace Game {
string
txnURLFileListMapping =
Config::getInstance().
- getString("TranslationGetURLFileListMapping");
+ getString("TranslationGetURLFileListMapping", "");
vector < string > languageFileMappings;
Tokenize(txnURLFileListMapping, languageFileMappings, "|");
@@ -842,45 +840,42 @@ namespace Game {
string
orig_txnURLUser =
- Config::getInstance().getString("TranslationGetURLUser");
+ Config::getInstance().getString("TranslationGetURLUser", "");
//string orig_txnURLPwd = Config::getInstance().getString("TranslationGetURLPassword","");
string
orig_txnURLLang =
- Config::getInstance().getString("TranslationGetURLLanguage");
+ Config::getInstance().getString("TranslationGetURLLanguage", "");
- Config::getInstance().setString("TranslationGetURLUser",
- labelTransifexUser.getText());
- Config::getInstance().setString("TranslationGetURLPassword",
- labelTransifexPwd.getText(), true);
- Config::getInstance().setString("TranslationGetURLLanguage",
- labelTransifexI18N.getText());
+ Config::getInstance().setString("TranslationGetURLUser", labelTransifexUser.getText());
+ Config::getInstance().setString("TranslationGetURLPassword", labelTransifexPwd.getText(), true);
+ Config::getInstance().setString("TranslationGetURLLanguage", labelTransifexI18N.getText());
bool
saveChanges = (orig_txnURLUser != labelTransifexUser.getText() ||
orig_txnURLLang != labelTransifexI18N.getText());
string
- txnURL = Config::getInstance().getString("TranslationGetURL");
+ txnURL = Config::getInstance().getString("TranslationGetURL", "");
string
txnURLUser =
- Config::getInstance().getString("TranslationGetURLUser");
+ Config::getInstance().getString("TranslationGetURLUser", "");
string
txnURLPwd =
- Config::getInstance().getString("TranslationGetURLPassword");
+ Config::getInstance().getString("TranslationGetURLPassword", "");
string
txnURLLang =
- Config::getInstance().getString("TranslationGetURLLanguage");
+ Config::getInstance().getString("TranslationGetURLLanguage", "");
string
txnURLFileList =
- Config::getInstance().getString("TranslationGetURLFileList");
+ Config::getInstance().getString("TranslationGetURLFileList", "");
string
txnURLFileListMapping =
Config::getInstance().
- getString("TranslationGetURLFileListMapping");
+ getString("TranslationGetURLFileListMapping", "");
string
txnURLDetails =
- Config::getInstance().getString("TranslationGetURLDetails");
+ Config::getInstance().getString("TranslationGetURLDetails", "");
string
credentials = txnURLUser + ":" + txnURLPwd;
@@ -1270,7 +1265,7 @@ namespace Game {
std::advance(iterMap, listBoxLang.getSelectedItemIndex());
config.setString("Lang", iterMap->first);
- lang.loadGameStrings(config.getString("Lang"));
+ lang.loadGameStrings(config.getString("Lang", "english"));
config.setString("FontSizeAdjustment",
listFontSizeAdjustment.getSelectedItem());
diff --git a/source/game/network/client_interface.cpp b/source/game/network/client_interface.cpp
index a4a09ec57..a74a466e7 100644
--- a/source/game/network/client_interface.cpp
+++ b/source/game/network/client_interface.cpp
@@ -1782,7 +1782,7 @@ namespace Game {
if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s] Line: %d %s %s %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, sErr.c_str(), sErr1.c_str(), sErr2.c_str());
if (echoLocal == true) {
- if (Config::getInstance().getBool("NetworkConsistencyChecks")) {
+ if (Config::getInstance().getBool("NetworkConsistencyChecks", "true")) {
// error message and disconnect only if checked
if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s] Line: %d\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
@@ -1792,7 +1792,7 @@ namespace Game {
}
}
- if (Config::getInstance().getBool("NetworkConsistencyChecks")) {
+ if (Config::getInstance().getBool("NetworkConsistencyChecks", "true")) {
// error message and disconnect only if checked
if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s] Line: %d\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
diff --git a/source/game/network/server_interface.cpp b/source/game/network/server_interface.cpp
index b5bf6c659..ee0b8ac28 100644
--- a/source/game/network/server_interface.cpp
+++ b/source/game/network/server_interface.cpp
@@ -2917,73 +2917,70 @@ namespace Game {
lastMasterserverHeartbeatTime = time(NULL);
if (needToRepublishToMasterserver == true) {
try {
- if (Config::getInstance().getString("Masterserver", "") != "") {
- string request = Config::getInstance().getString("Masterserver");
- if (request != "") {
- endPathWithSlash(request, false);
- }
- request += "addServerInfo.php?";
-
- std::map newPublishToServerInfo = publishToMasterserver();
-
- CURL *handle = SystemFlags::initHTTP();
- for (std::map::const_iterator iterMap = newPublishToServerInfo.begin();
- iterMap != newPublishToServerInfo.end(); ++iterMap) {
-
- request += iterMap->first;
- request += "=";
- request += SystemFlags::escapeURL(iterMap->second, handle);
- request += "&";
- }
-
- //printf("The Host request is:\n%s\n",request.c_str());
- if (SystemFlags::VERBOSE_MODE_ENABLED) printf("The Host request is:\n%s\n", request.c_str());
-
- if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line %d] the request is:\n%s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, request.c_str());
-
- if (SystemFlags::VERBOSE_MODE_ENABLED) printf("Calling masterserver [%s]...\n", request.c_str());
-
- std::string serverInfo = SystemFlags::getHTTP(request, handle);
- //printf("Result:\n%s\n",serverInfo .c_str());
-
- string requestStats = Config::getInstance().getString("Masterserver");
- if (requestStats != "") {
- endPathWithSlash(requestStats, false);
- }
- requestStats += "addGameStats.php?";
-
- std::map newPublishToServerInfoStats = publishToMasterserverStats();
- if (newPublishToServerInfoStats.empty() == false) {
- for (std::map::const_iterator iterMap = newPublishToServerInfoStats.begin();
- iterMap != newPublishToServerInfoStats.end(); ++iterMap) {
-
- requestStats += iterMap->first;
- requestStats += "=";
- requestStats += SystemFlags::escapeURL(iterMap->second, handle);
- requestStats += "&";
- }
-
- //printf("The Host stats request is:\n%s\n",requestStats.c_str());
- if (SystemFlags::VERBOSE_MODE_ENABLED) printf("The Host request is:\n%s\n", requestStats.c_str());
- if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line %d] the request is:\n%s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, requestStats.c_str());
- if (SystemFlags::VERBOSE_MODE_ENABLED) printf("Calling masterserver [%s]...\n", requestStats.c_str());
-
- std::string serverInfoStats = SystemFlags::getHTTP(requestStats, handle);
- //printf("Result:\n%s\n",serverInfoStats .c_str());
-
- if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line %d] the result is:\n'%s'\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, serverInfoStats.c_str());
- }
-
- SystemFlags::cleanupHTTP(&handle);
-
- if (SystemFlags::VERBOSE_MODE_ENABLED) printf("Done Calling masterserver\n");
-
- //printf("the result is:\n'%s'\n",serverInfo.c_str());
- if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line %d] the result is:\n'%s'\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, serverInfo.c_str());
- } else {
- SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line %d] error, no masterserver defined!\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__);
+ string request = Config::getInstance().getString("Masterserver", "http://master.megaglest.org/");
+ if (request != "") {
+ endPathWithSlash(request, false);
}
- } catch (const exception &ex) {
+ request += "addServerInfo.php?";
+
+ std::map newPublishToServerInfo = publishToMasterserver();
+
+ CURL* handle = SystemFlags::initHTTP();
+ for (std::map::const_iterator iterMap = newPublishToServerInfo.begin();
+ iterMap != newPublishToServerInfo.end(); ++iterMap) {
+
+ request += iterMap->first;
+ request += "=";
+ request += SystemFlags::escapeURL(iterMap->second, handle);
+ request += "&";
+ }
+
+ //printf("The Host request is:\n%s\n",request.c_str());
+ if (SystemFlags::VERBOSE_MODE_ENABLED) printf("The Host request is:\n%s\n", request.c_str());
+
+ if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line %d] the request is:\n%s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, request.c_str());
+
+ if (SystemFlags::VERBOSE_MODE_ENABLED) printf("Calling masterserver [%s]...\n", request.c_str());
+
+ std::string serverInfo = SystemFlags::getHTTP(request, handle);
+ //printf("Result:\n%s\n",serverInfo .c_str());
+
+ string requestStats = Config::getInstance().getString("Masterserver", "http://master.megaglest.org/");
+ if (requestStats != "") {
+ endPathWithSlash(requestStats, false);
+ }
+ requestStats += "addGameStats.php?";
+
+ std::map newPublishToServerInfoStats = publishToMasterserverStats();
+ if (newPublishToServerInfoStats.empty() == false) {
+ for (std::map::const_iterator iterMap = newPublishToServerInfoStats.begin();
+ iterMap != newPublishToServerInfoStats.end(); ++iterMap) {
+
+ requestStats += iterMap->first;
+ requestStats += "=";
+ requestStats += SystemFlags::escapeURL(iterMap->second, handle);
+ requestStats += "&";
+ }
+
+ //printf("The Host stats request is:\n%s\n",requestStats.c_str());
+ if (SystemFlags::VERBOSE_MODE_ENABLED) printf("The Host request is:\n%s\n", requestStats.c_str());
+ if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line %d] the request is:\n%s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, requestStats.c_str());
+ if (SystemFlags::VERBOSE_MODE_ENABLED) printf("Calling masterserver [%s]...\n", requestStats.c_str());
+
+ std::string serverInfoStats = SystemFlags::getHTTP(requestStats, handle);
+ //printf("Result:\n%s\n",serverInfoStats .c_str());
+
+ if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line %d] the result is:\n'%s'\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, serverInfoStats.c_str());
+ }
+
+ SystemFlags::cleanupHTTP(&handle);
+
+ if (SystemFlags::VERBOSE_MODE_ENABLED) printf("Done Calling masterserver\n");
+
+ //printf("the result is:\n'%s'\n",serverInfo.c_str());
+ if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line %d] the result is:\n'%s'\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, serverInfo.c_str());
+ }
+ catch (const exception & ex) {
SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line %d] error during game status update: [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what());
}
}
diff --git a/source/game/sound/sound_renderer.cpp b/source/game/sound/sound_renderer.cpp
index be67ae250..50162e122 100644
--- a/source/game/sound/sound_renderer.cpp
+++ b/source/game/sound/sound_renderer.cpp
@@ -58,7 +58,7 @@ namespace Game {
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s %d]\n", __FILE__, __FUNCTION__, __LINE__);
Config &config = Config::getInstance();
- si.setFactory(fr.getSoundFactory(config.getString("FactorySound")));
+ si.setFactory(fr.getSoundFactory(config.getString("FactorySound", "OpenAL")));
cleanup();
stopAllSounds();
@@ -71,8 +71,8 @@ namespace Game {
soundPlayer = si.newSoundPlayer();
if (soundPlayer != NULL) {
SoundPlayerParams soundPlayerParams;
- soundPlayerParams.staticBufferCount = config.getInt("SoundStaticBuffers");
- soundPlayerParams.strBufferCount = config.getInt("SoundStreamingBuffers");
+ soundPlayerParams.staticBufferCount = config.getInt("SoundStaticBuffers", "16");
+ soundPlayerParams.strBufferCount = config.getInt("SoundStreamingBuffers", "4");
soundPlayer->init(&soundPlayerParams);
}
safeMutex.ReleaseLock();
@@ -105,8 +105,8 @@ namespace Game {
result = soundPlayer->wasInitOk();
} else {
Config &config = Config::getInstance();
- if (config.getString("FactorySound") == "" ||
- config.getString("FactorySound") == "None") {
+ if (config.getString("FactorySound", "OpenAL") == "" ||
+ config.getString("FactorySound", "OpenAL") == "None") {
result = true;
}
}
@@ -279,9 +279,9 @@ namespace Game {
void SoundRenderer::loadConfig() {
Config &config = Config::getInstance();
- fxVolume = config.getInt("SoundVolumeFx") / 100.f;
- musicVolume = config.getInt("SoundVolumeMusic") / 100.f;
- ambientVolume = config.getInt("SoundVolumeAmbient") / 100.f;
+ fxVolume = config.getInt("SoundVolumeFx", "70") / 100.f;
+ musicVolume = config.getInt("SoundVolumeMusic", "70") / 100.f;
+ ambientVolume = config.getInt("SoundVolumeAmbient", "70") / 100.f;
}
} //end namespace
diff --git a/source/game/world/world.cpp b/source/game/world/world.cpp
index acf5dedb9..617fe4f13 100644
--- a/source/game/world/world.cpp
+++ b/source/game/world/world.cpp
@@ -69,8 +69,8 @@ namespace Game {
fogOfWarOverride = false;
fogOfWarSkillTypeValue = -1;
- fogOfWarSmoothing = config.getBool("FogOfWarSmoothing");
- fogOfWarSmoothingFrameSkip = config.getInt("FogOfWarSmoothingFrameSkip");
+ fogOfWarSmoothing = config.getBool("FogOfWarSmoothing", "true");
+ fogOfWarSmoothingFrameSkip = config.getInt("FogOfWarSmoothingFrameSkip", "3");
frameCount = 0;
diff --git a/source/shared_lib/sources/util/properties.cpp b/source/shared_lib/sources/util/properties.cpp
index a57709b4b..3e1748519 100644
--- a/source/shared_lib/sources/util/properties.cpp
+++ b/source/shared_lib/sources/util/properties.cpp
@@ -83,7 +83,7 @@ namespace Shared {
if (fileStream.is_open() == false) {
if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] path = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, path.c_str());
- throw game_runtime_error("File NOT FOUND, can't open file: [" + path + "]");
+ printf("%s", "\nFile NOT FOUND, can't open file: [" + path + "]\n");
}
if (clearCurrentProperties == true) {