From daeec7432866301dc778bc07f7919856f2181b52 Mon Sep 17 00:00:00 2001 From: mathusummut Date: Fri, 5 Apr 2019 23:37:26 +0200 Subject: [PATCH] Fixed and added some paths --- mk/windows/vs2019-32/glest.vcxproj | 2 +- mk/windows/vs2019-64/glest.vcxproj | 2 +- source/g3d_viewer/main.cpp | 2 +- source/game/global/config.cpp | 43 ++++++----- source/game/main/battle_end.cpp | 2 +- source/game/main/main.cpp | 2 + source/game/menu/main_menu.cpp | 2 +- .../game/menu/menu_state_connected_game.cpp | 10 +-- source/game/menu/menu_state_join_game.cpp | 4 +- source/game/menu/menu_state_load_game.cpp | 2 +- source/game/menu/menu_state_masterserver.cpp | 14 ++-- source/game/menu/menu_state_new_game.cpp | 2 +- source/game/menu/menu_state_options.cpp | 2 + .../game/menu/menu_state_options_graphics.cpp | 72 +++++++++---------- .../game/menu/menu_state_options_network.cpp | 4 +- source/game/menu/menu_state_options_sound.cpp | 10 +-- source/game/menu/menu_state_root.cpp | 2 +- source/game/menu/menu_state_scenario.cpp | 2 +- source/game/world/time_flow.cpp | 2 +- .../include/platform/sdl/data_types.h | 1 - .../include/platform/sdl/platform_util.h | 1 - .../platform/common/platform_common.cpp | 2 +- source/shared_lib/sources/util/properties.cpp | 2 +- 23 files changed, 96 insertions(+), 91 deletions(-) diff --git a/mk/windows/vs2019-32/glest.vcxproj b/mk/windows/vs2019-32/glest.vcxproj index e288e4180..98e27e64b 100644 --- a/mk/windows/vs2019-32/glest.vcxproj +++ b/mk/windows/vs2019-32/glest.vcxproj @@ -472,7 +472,7 @@ true ../../../external/libircclient/include;../../../source/shared_lib/include;../../../source/shared_lib/include/graphics;../../../source/shared_lib/include/graphics/gl;../../../source/shared_lib/include/platform;../../../source/shared_lib/include/platform/win32;../../../source/shared_lib/include/sound;../../../source/shared_lib/include/util;../../../source/shared_lib/include/lua;../../../source/shared_lib/include/xml;../../../source/shared_lib/include/xml/rapidxml;../../../source/game/ai;../../../source/game/facilities;../../../source/game/game;../../../source/game/global;../../../source/game/graphics;../../../source/game/gui;../../../source/game/main;../../../source/game/menu;../../../source/game/network;../../../source/game/sound;../../../source/game/steam;../../../source/game/steamshim;../../../source/game/type_instances;../../../source/game/types;../../../source/game/world;../dependencies/src/xerces/src;../dependencies/src/sdl2/include;../../../source/shared_lib/include/platform/sdl;../../../source/shared_lib/include/sound/openal;../dependencies/src/openal/include;../../../source/shared_lib/include/platform/posix;../../../source/shared_lib/include/streflop;../../../source/shared_lib/include/platform/common;../dependencies/src/curl/include;../../../source/shared_lib/include/map;../dependencies/src/irc/include;../dependencies/src/glew/include;../../../source/shared_lib/include/compression;..\dependencies\src\lua\src;..\dependencies\src\lua;..\dependencies %(AdditionalUsingDirectories) - NDEBUG;WIN32;AL_LIBTYPE_STATIC;_LIB;_WINDOWS;XML_LIBRARY;USE_PCH=1;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;UNICODE;XERCES_STATIC_LIBRARY;GLEW_STATIC;STATICLIB;USE_FTGL;FTGL_LIBRARY_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + NDEBUG;WIN32;AL_LIBTYPE_STATIC;_LIB;_CONSOLE;XML_LIBRARY;USE_PCH=1;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;UNICODE;XERCES_STATIC_LIBRARY;GLEW_STATIC;STATICLIB;USE_FTGL;FTGL_LIBRARY_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) true Async MultiThreaded diff --git a/mk/windows/vs2019-64/glest.vcxproj b/mk/windows/vs2019-64/glest.vcxproj index 9b162d3d5..9b672f9a9 100644 --- a/mk/windows/vs2019-64/glest.vcxproj +++ b/mk/windows/vs2019-64/glest.vcxproj @@ -386,7 +386,7 @@ true ../../../external/libircclient/include;../../../source/shared_lib/include;../../../source/shared_lib/include/graphics;../../../source/shared_lib/include/graphics/gl;../../../source/shared_lib/include/platform;../../../source/shared_lib/include/platform/win32;../../../source/shared_lib/include/sound;../../../source/shared_lib/include/util;../../../source/shared_lib/include/lua;../../../source/shared_lib/include/xml;../../../source/shared_lib/include/xml/rapidxml;../../../source/game/ai;../../../source/game/facilities;../../../source/game/game;../../../source/game/global;../../../source/game/graphics;../../../source/game/gui;../../../source/game/main;../../../source/game/menu;../../../source/game/network;../../../source/game/sound;../../../source/game/steam;../../../source/game/steamshim;../../../source/game/type_instances;../../../source/game/types;../../../source/game/world;../dependencies/src/xerces/src;../dependencies/src/sdl2/include;../../../source/shared_lib/include/platform/sdl;../../../source/shared_lib/include/sound/openal;../dependencies/src/openal/include;../../../source/shared_lib/include/platform/posix;../../../source/shared_lib/include/streflop;../../../source/shared_lib/include/platform/common;../dependencies/src/curl/include;../../../source/shared_lib/include/map;../dependencies/src/irc/include;../dependencies/src/glew/include;../../../source/shared_lib/include/compression;..\dependencies\src\lua\src;..\dependencies\src\lua;..\dependencies\ %(AdditionalUsingDirectories) - NDEBUG;WIN32;AL_LIBTYPE_STATIC;_LIB;_WINDOWS;XML_LIBRARY;USE_PCH=1;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;UNICODE;XERCES_STATIC_LIBRARY;GLEW_STATIC;STATICLIB;USE_FTGL;FTGL_LIBRARY_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) + NDEBUG;WIN32;_CONSOLE;AL_LIBTYPE_STATIC;_LIB;XML_LIBRARY;USE_PCH=1;_CRT_SECURE_NO_WARNINGS;CURL_STATICLIB;UNICODE;XERCES_STATIC_LIBRARY;GLEW_STATIC;STATICLIB;USE_FTGL;FTGL_LIBRARY_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) true Async MultiThreaded diff --git a/source/g3d_viewer/main.cpp b/source/g3d_viewer/main.cpp index 408d00648..c2332b362 100644 --- a/source/g3d_viewer/main.cpp +++ b/source/g3d_viewer/main.cpp @@ -174,7 +174,7 @@ namespace Shared { // "================================================================================" printf("\n%s %s, [Using %s]\n", extractFileFromDirectoryPath(argv0).c_str(), G3DViewerVersionString.c_str(), (const char *) wxConvCurrent->cWX2MB(wxVERSION_STRING)); - printf("\nDisplays glest 3D-models and unit/projectile/splash particle systems.\n"); + printf("\nDisplays Glest 3D-models and unit/projectile/splash particle systems.\n"); printf("\nRotate with left mouse button. Zoom with right mouse button or mousewheel."); printf("\nUse ctrl to load more than one particle system."); printf("\nPress R to restart particles, this also reloads all files if they are changed."); diff --git a/source/game/global/config.cpp b/source/game/global/config.cpp index d0dbe7902..00c5314f6 100644 --- a/source/game/global/config.cpp +++ b/source/game/global/config.cpp @@ -33,6 +33,8 @@ #ifdef WIN32 #include #include "Shlobj.h" +#include +#include #endif using namespace Shared::Platform; @@ -147,14 +149,13 @@ namespace Game { && file.first == glestkeys_ini_filename && file.second == glestuserkeys_ini_filename)) { - string linuxPath = custom_path; if (SystemFlags::VERBOSE_MODE_ENABLED) printf ("-=-=-=-=-=-=-= looking for file in possible location [%s]\n", - linuxPath.c_str()); + custom_path.c_str()); #if defined(__linux__) - string nixFile = linuxPath + "linux_" + file.first; + string nixFile = custom_path + "linux_" + file.first; if (SystemFlags::VERBOSE_MODE_ENABLED) printf ("-=-=-=-=-=-=-= looking for linux specific file in possible location [%s]\n", @@ -162,17 +163,17 @@ namespace Game { if (wasFound == false && fileExists(nixFile) == true) { file.first = nixFile; - file.second = linuxPath + file.second; + file.second = custom_path + file.second; wasFound = true; } - nixFile = linuxPath + "linux_" + file.second; + nixFile = custom_path + "linux_" + file.second; if (wasFound == false && fileExists(nixFile) == true) { - file.first = linuxPath + file.first; + file.first = custom_path + file.first; file.second = nixFile; wasFound = true; } #elif defined(__WIN32__) - string winFile = linuxPath + "windows_" + file.first; + string winFile = custom_path + "windows_" + file.first; if (SystemFlags::VERBOSE_MODE_ENABLED) printf ("-=-=-=-=-=-=-= looking for windows specific file in possible location [%s]\n", @@ -180,26 +181,26 @@ namespace Game { if (wasFound == false && fileExists(winFile) == true) { file.first = winFile; - file.second = linuxPath + file.second; + file.second = custom_path + file.second; wasFound = true; } - winFile = linuxPath + "windows_" + file.second; + winFile = custom_path + "windows_" + file.second; if (wasFound == false && fileExists(winFile) == true) { - file.first = linuxPath + file.first; + file.first = custom_path + file.first; file.second = winFile; wasFound = true; } #endif - string realPath = linuxPath + file.first; + string realPath = custom_path + file.first; if (wasFound == false && fileExists(realPath) == true) { file.first = realPath; - file.second = linuxPath + file.second; + file.second = custom_path + file.second; wasFound = true; } - realPath = linuxPath + file.second; + realPath = custom_path + file.second; if (wasFound == false && fileExists(realPath) == true) { - file.first = linuxPath + file.first; + file.first = custom_path + file.first; file.second = realPath; wasFound = true; } @@ -242,16 +243,20 @@ namespace Game { char* env = getenv("APPDATA"); if (env != NULL) { currentpath = env; - foundPath = tryCustomPath(cfgType, fileName, endPathWithSlash(currentpath)); + foundPath = tryCustomPath(cfgType, fileName, endPathWithSlash(currentpath, true) + "glest\\"); } } if (foundPath == false) { - PWSTR path = NULL; + wchar_t* path = NULL; // Get path for each computer, non-user specific and non-roaming data. - if (SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &path) != S_OK) { + if (SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &path) == S_OK) { if (path != NULL) { - currentpath = *path; - foundPath = tryCustomPath(cfgType, fileName, endPathWithSlash(currentpath)); + wstringstream ss; + ss << path; + using convert_type = std::codecvt_utf8; + std::wstring_convert converter; + currentpath = converter.to_bytes(ss.str()); + foundPath = tryCustomPath(cfgType, fileName, endPathWithSlash(currentpath, true) + "glest\\"); CoTaskMemFree(path); } } diff --git a/source/game/main/battle_end.cpp b/source/game/main/battle_end.cpp index f8ff2b091..9424ae6f2 100644 --- a/source/game/main/battle_end.cpp +++ b/source/game/main/battle_end.cpp @@ -451,7 +451,7 @@ namespace Game { void BattleEnd::update() { - if (Config::getInstance().getBool("AutoTest")) { + if (Config::getInstance().getBool("AutoTest", "false")) { AutoTest::getInstance().updateBattleEnd(program); return; } diff --git a/source/game/main/main.cpp b/source/game/main/main.cpp index c957d6b08..2ddc8a7a9 100644 --- a/source/game/main/main.cpp +++ b/source/game/main/main.cpp @@ -6199,8 +6199,10 @@ namespace Game { LuaScript::setDisableSandbox(true); } #ifdef _WIN32 +#ifndef SHOW_CONSOLE if (config.getBool("ShowConsoleWindows", "false") == false && GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) ShowWindow(GetConsoleWindow(), SW_HIDE); +#endif #endif if (hasCommandArgument diff --git a/source/game/menu/main_menu.cpp b/source/game/menu/main_menu.cpp index 9ccd1c791..f06b7051d 100644 --- a/source/game/menu/main_menu.cpp +++ b/source/game/menu/main_menu.cpp @@ -397,7 +397,7 @@ namespace Game { //switch on menu music again, it might be muted Config & config = Config::getInstance(); float - configVolume = (config.getInt("SoundVolumeMusic") / 100.f); + configVolume = (config.getInt("SoundVolumeMusic", "70") / 100.f); CoreData::getInstance().getMenuMusic()->setVolume(configVolume); string diff --git a/source/game/menu/menu_state_connected_game.cpp b/source/game/menu/menu_state_connected_game.cpp index ed8dc25ce..0a177d7c8 100644 --- a/source/game/menu/menu_state_connected_game.cpp +++ b/source/game/menu/menu_state_connected_game.cpp @@ -647,7 +647,7 @@ namespace Game { ConfigType >(cfgMainKeys, cfgUserKeys)); console.addLine(lang.getString("ToSwitchOffMusicPress") + " - \"" + - configKeys.getString("ToggleMusic") + "\""); + configKeys.getString("ToggleMusic", "K") + "\""); chatManager.init(&console, -1, true); GraphicComponent::applyAllCustomProperties(containerName); @@ -1279,7 +1279,7 @@ namespace Game { printf("In [%s::%s Line %d]\n", __FILE__, __FUNCTION__, __LINE__); if (config.getString("Masterserver", "") != "") { - string baseURL = config.getString("Masterserver"); + string baseURL = config.getString("Masterserver", "http://master.megaglest.org/"); if (baseURL != "") { endPathWithSlash(baseURL, false); } @@ -5633,7 +5633,7 @@ namespace Game { //switch on music again!! Config & config = Config::getInstance(); float - configVolume = (config.getInt("SoundVolumeMusic") / 100.f); + configVolume = (config.getInt("SoundVolumeMusic", "70") / 100.f); CoreData::getInstance(). getMenuMusic()->setVolume(configVolume); } @@ -5958,7 +5958,7 @@ namespace Game { Lang & lang = Lang::getInstance(); float - configVolume = (config.getInt("SoundVolumeMusic") / 100.f); + configVolume = (config.getInt("SoundVolumeMusic", "70") / 100.f); float currentVolume = CoreData::getInstance().getMenuMusic()->getVolume(); @@ -7791,7 +7791,7 @@ namespace Game { //switch on music again!! Config & config = Config::getInstance(); float - configVolume = (config.getInt("SoundVolumeMusic") / 100.f); + configVolume = (config.getInt("SoundVolumeMusic", "70") / 100.f); if (factionVideoSwitchedOffVolume) { if (CoreData::getInstance().getMenuMusic()->getVolume() != configVolume) { diff --git a/source/game/menu/menu_state_join_game.cpp b/source/game/menu/menu_state_join_game.cpp index 44197777d..cd6c3d62c 100644 --- a/source/game/menu/menu_state_join_game.cpp +++ b/source/game/menu/menu_state_join_game.cpp @@ -213,7 +213,7 @@ namespace Game { autoConnectToServer = true; } else { - string hostIP = config.getString("ServerIp"); + string hostIP = config.getString("ServerIp", ""); if (portNumberOverride > 0) { hostIP += ":" + intToStr(portNumberOverride); } @@ -914,7 +914,7 @@ namespace Game { labelInfo.setText(""); //save server ip - if (config.getString("ServerIp") != serverIp.getString()) { + if (config.getString("ServerIp", serverIp.getString().c_str()) != serverIp.getString()) { config.setString("ServerIp", serverIp.getString()); config.save(); } diff --git a/source/game/menu/menu_state_load_game.cpp b/source/game/menu/menu_state_load_game.cpp index f1161d9df..74ff9e0fd 100644 --- a/source/game/menu/menu_state_load_game.cpp +++ b/source/game/menu/menu_state_load_game.cpp @@ -516,7 +516,7 @@ namespace Game { } void MenuStateLoadGame::update() { - if (Config::getInstance().getBool("AutoTest")) { + if (Config::getInstance().getBool("AutoTest", "false")) { AutoTest::getInstance().updateNewGame(program, mainMenu); return; } diff --git a/source/game/menu/menu_state_masterserver.cpp b/source/game/menu/menu_state_masterserver.cpp index 8b25620d5..2d7f0c802 100644 --- a/source/game/menu/menu_state_masterserver.cpp +++ b/source/game/menu/menu_state_masterserver.cpp @@ -320,7 +320,7 @@ namespace Game { ircArgs.push_back(IRC_SERVER); if (Config::getInstance().getString("IRCNick", "") != "") { - ircArgs.push_back(Config::getInstance().getString("IRCNick")); + ircArgs.push_back(Config::getInstance().getString("IRCNick", "")); } else { ircArgs.push_back(szIRCNick); } @@ -329,13 +329,13 @@ namespace Game { ircArgs.push_back(IRC_CHANNEL); if (Config::getInstance().getString("IRCUsername", "") != "") { - ircArgs.push_back(Config::getInstance().getString("IRCUsername")); + ircArgs.push_back(Config::getInstance().getString("IRCUsername", "")); } else { ircArgs.push_back(szIRCNick); } if (Config::getInstance().getString("IRCPassword", "") != "") { ircArgs.push_back("identify " + - Config::getInstance().getString("IRCPassword")); + Config::getInstance().getString("IRCPassword", "")); } else { ircArgs.push_back(""); } @@ -1105,7 +1105,7 @@ namespace Game { //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); playServerFoundSound = false; @@ -1246,7 +1246,7 @@ namespace Game { Config::getInstance(std::pair < ConfigType, ConfigType >(cfgMainKeys, cfgUserKeys)); consoleIRC.addLine(Lang::getInstance().getString("ToSwitchOffMusicPress") + " - \"" + - configKeys.getString("ToggleMusic") + "\""); + configKeys.getString("ToggleMusic", "K") + "\""); consoleIRC.addLine(""); announcementLoaded = true; } @@ -1264,7 +1264,7 @@ namespace Game { getString("PlayerId", "")); string baseURL = - Config::getInstance().getString("Masterserver"); + Config::getInstance().getString("Masterserver", "http://master.megaglest.org/"); if (baseURL != "") { endPathWithSlash(baseURL, false); } @@ -1577,7 +1577,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_new_game.cpp b/source/game/menu/menu_state_new_game.cpp index b6b3e2607..2af584b84 100644 --- a/source/game/menu/menu_state_new_game.cpp +++ b/source/game/menu/menu_state_new_game.cpp @@ -157,7 +157,7 @@ namespace Game { } void MenuStateNewGame::update() { - if (Config::getInstance().getBool("AutoTest")) { + if (Config::getInstance().getBool("AutoTest", "false")) { AutoTest::getInstance().updateNewGame(program, mainMenu); return; } diff --git a/source/game/menu/menu_state_options.cpp b/source/game/menu/menu_state_options.cpp index d0b0589d9..c9ede7b96 100644 --- a/source/game/menu/menu_state_options.cpp +++ b/source/game/menu/menu_state_options.cpp @@ -1317,10 +1317,12 @@ namespace Game { config.save(); #ifdef _WIN32 +#ifndef SHOW_CONSOLE if (checkBoxShowDeveloperConsoleOnWindows.getValue()) ShowWindow(GetConsoleWindow(), SW_SHOW); else if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) ShowWindow(GetConsoleWindow(), SW_HIDE); +#endif #endif Renderer::getInstance().loadConfig(); console.addLine(lang.getString("SettingsSaved")); diff --git a/source/game/menu/menu_state_options_graphics.cpp b/source/game/menu/menu_state_options_graphics.cpp index 9b60f2e39..fc8c2f0f4 100644 --- a/source/game/menu/menu_state_options_graphics.cpp +++ b/source/game/menu/menu_state_options_graphics.cpp @@ -110,9 +110,7 @@ namespace Game { screenModeChangedTimer = time(NULL); // just init ::Shared::PlatformCommon::getFullscreenVideoModes(&modeInfos, - !config. - getBool - ("Windowed")); + !config.getBool("Windowed", "false")); int leftLabelStart = 100; @@ -198,9 +196,9 @@ namespace Game { init(currentColumnStart, currentLine, 200); string - currentResString = config.getString("ScreenWidth") + "x" + - config.getString("ScreenHeight") + "-" + - intToStr(config.getInt("ColorBits")); + currentResString = config.getString("ScreenWidth", "1024") + "x" + + config.getString("ScreenHeight", "768") + "-" + + intToStr(config.getInt("ColorBits", "32")); bool currentResolutionFound = false; for (vector < ModeInfo >::const_iterator it = modeInfos.begin(); @@ -223,7 +221,7 @@ namespace Game { checkBoxFullscreenWindowed.init(currentColumnStart, currentLine); labelFullscreenWindowed.setText(lang.getString("Windowed")); - checkBoxFullscreenWindowed.setValue(config.getBool("Windowed")); + checkBoxFullscreenWindowed.setValue(config.getBool("Windowed", "false")); currentLine -= lineOffset; //gammaCorrection @@ -250,7 +248,7 @@ namespace Game { listBoxFilter.init(currentColumnStart, currentLine, 200); listBoxFilter.pushBackItem("Bilinear"); listBoxFilter.pushBackItem("Trilinear"); - listBoxFilter.setSelectedItem(config.getString("Filter")); + listBoxFilter.setSelectedItem(config.getString("Filter", "Bilinear")); currentLine -= lineOffset; //FilterMaxAnisotropy @@ -305,7 +303,7 @@ namespace Game { (i)))); } string - str = config.getString("Shadows"); + str = config.getString("Shadows", "Projected"); listBoxShadows. setSelectedItemIndex(clamp (Renderer::strToShadows(str), 0, @@ -349,7 +347,7 @@ namespace Game { checkBoxTextures3D.init(currentColumnStart, currentLine); labelTextures3D.setText(lang.getString("Textures3D")); - checkBoxTextures3D.setValue(config.getBool("Textures3D")); + checkBoxTextures3D.setValue(config.getBool("Textures3D", "1")); currentLine -= lineOffset; //lights @@ -362,7 +360,7 @@ namespace Game { } listBoxLights. setSelectedItemIndex(clamp - (config.getInt("MaxLights") - 1, 0, 7)); + (config.getInt("MaxLights", "8") - 1, 0, 7)); currentLine -= lineOffset; //unit particles @@ -556,28 +554,26 @@ namespace Game { Config & config = Config::getInstance(); //!!! // Revert resolution or fullscreen - checkBoxFullscreenWindowed.setValue(config.getBool("Windowed")); + checkBoxFullscreenWindowed.setValue(config.getBool("Windowed", "false")); string - currentResString = config.getString("ScreenWidth") + "x" + - config.getString("ScreenHeight") + "-" + - intToStr(config.getInt("ColorBits")); + currentResString = config.getString("ScreenWidth", "1024") + "x" + + config.getString("ScreenHeight", "768") + "-" + + intToStr(config.getInt("ColorBits", "32")); listBoxScreenModes.setSelectedItem(currentResString); - changeVideoModeFullScreen(!config.getBool("Windowed")); + changeVideoModeFullScreen(!config.getBool("Windowed", "false")); WindowGl * window = this->program->getWindow(); window->ChangeVideoMode(true, - config.getInt("ScreenWidth"), - config.getInt("ScreenHeight"), - !config.getBool("Windowed"), - config.getInt("ColorBits"), - config.getInt("DepthBits"), - config.getInt("StencilBits"), - config.getBool("HardwareAcceleration", - "true"), - config.getBool("FullScreenAntiAliasing", - "false"), + config.getInt("ScreenWidth", "1024"), + config.getInt("ScreenHeight", "768"), + !config.getBool("Windowed", "false"), + config.getInt("ColorBits", "32"), + config.getInt("DepthBits", "16"), + config.getInt("StencilBits", "0"), + config.getBool("HardwareAcceleration", "true"), + config.getBool("FullScreenAntiAliasing", "false"), config.getFloat("GammaValue", "0.0")); Metrics::reload(this->program->getWindow()->getScreenWidth(), this->program->getWindow()->getScreenHeight()); @@ -661,13 +657,13 @@ namespace Game { selectedFullscreenWindowed = checkBoxFullscreenWindowed.getValue(); string currentResolution = - config.getString("ScreenWidth") + "x" + - config.getString("ScreenHeight") + "-" + - intToStr(config.getInt("ColorBits")); + config.getString("ScreenWidth", "1024") + "x" + + config.getString("ScreenHeight", "768") + "-" + + intToStr(config.getInt("ColorBits", "32")); string selectedResolution = listBoxScreenModes.getSelectedItem(); bool - currentFullscreenWindowed = config.getBool("Windowed"); + currentFullscreenWindowed = config.getBool("Windowed", "false"); if (currentResolution != selectedResolution || currentFullscreenWindowed != selectedFullscreenWindowed) { @@ -715,12 +711,10 @@ namespace Game { selectedMode->height, !selectedFullscreenWindowed, selectedMode->depth, - config.getInt("DepthBits"), - config.getInt("StencilBits"), - config.getBool("HardwareAcceleration", - "true"), - config.getBool("FullScreenAntiAliasing", - "false"), + config.getInt("DepthBits", "16"), + config.getInt("StencilBits", "0"), + config.getBool("HardwareAcceleration", "true"), + config.getBool("FullScreenAntiAliasing", "false"), strToFloat(listBoxGammaCorrection. getSelectedItem())); @@ -1010,8 +1004,8 @@ namespace Game { string currentResolution = - config.getString("ScreenWidth") + "x" + - config.getString("ScreenHeight"); + config.getString("ScreenWidth", "1024") + "x" + + config.getString("ScreenHeight", "768"); string selectedResolution = listBoxScreenModes.getSelectedItem(); if (currentResolution != selectedResolution) { @@ -1028,10 +1022,12 @@ namespace Game { config.save(); #ifdef _WIN32 +#ifndef SHOW_CONSOLE if (config.getBool("ShowConsoleWindows", "false") == true) ShowWindow(GetConsoleWindow(), SW_SHOW); else if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) ShowWindow(GetConsoleWindow(), SW_HIDE); +#endif #endif Renderer::getInstance().loadConfig(); diff --git a/source/game/menu/menu_state_options_network.cpp b/source/game/menu/menu_state_options_network.cpp index bea8a4022..445e12c58 100644 --- a/source/game/menu/menu_state_options_network.cpp +++ b/source/game/menu/menu_state_options_network.cpp @@ -571,10 +571,10 @@ namespace Game { setActiveInputLable(NULL); - lang.loadGameStrings(config.getString("Lang")); + lang.loadGameStrings(config.getString("Lang", "english")); config.setString("PortServer", listBoxServerPort.getSelectedItem()); - config.setInt("FTPServerPort", config.getInt("PortServer") + 1); + config.setInt("FTPServerPort", config.getInt("PortServer", "61357") + 1); config.setBool("EnableFTPXfer", checkBoxEnableFTP.getValue()); config.setBool("EnableFTPServer", checkBoxEnableFTPServer.getValue()); diff --git a/source/game/menu/menu_state_options_sound.cpp b/source/game/menu/menu_state_options_sound.cpp index 398bd4aaf..00a16def8 100644 --- a/source/game/menu/menu_state_options_sound.cpp +++ b/source/game/menu/menu_state_options_sound.cpp @@ -163,7 +163,7 @@ namespace Game { pushBackItem("OpenAL"); string - FSoundMode = lang.getString(config.getString("FactorySound")); + FSoundMode = lang.getString(config.getString("FactorySound", "OpenAL")); listBoxSoundFactory. setSelectedItem(FSoundMode); currentLine -= @@ -206,13 +206,13 @@ namespace Game { pushBackItem(intToStr(i)); } listBoxVolumeFx. - setSelectedItem(intToStr(config.getInt("SoundVolumeFx"))); + setSelectedItem(intToStr(config.getInt("SoundVolumeFx", "70"))); listBoxVolumeAmbient. setSelectedItem(intToStr - (config.getInt("SoundVolumeAmbient"))); + (config.getInt("SoundVolumeAmbient", "70"))); listBoxVolumeMusic. setSelectedItem(intToStr - (config.getInt("SoundVolumeMusic"))); + (config.getInt("SoundVolumeMusic", "70"))); //currentLine-=lineOffset/2; @@ -478,10 +478,12 @@ namespace Game { config.save(); #ifdef _WIN32 +#ifndef SHOW_CONSOLE if (config.getBool("ShowConsoleWindows", "false") == true) ShowWindow(GetConsoleWindow(), SW_SHOW); else if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) ShowWindow(GetConsoleWindow(), SW_HIDE); +#endif #endif SoundRenderer & soundRenderer = SoundRenderer::getInstance(); diff --git a/source/game/menu/menu_state_root.cpp b/source/game/menu/menu_state_root.cpp index 79b74d868..20d5c25f4 100644 --- a/source/game/menu/menu_state_root.cpp +++ b/source/game/menu/menu_state_root.cpp @@ -741,7 +741,7 @@ namespace Game { } void MenuStateRoot::update() { - if (Config::getInstance().getBool("AutoTest")) { + if (Config::getInstance().getBool("AutoTest", "false")) { if (AutoTest::getInstance().mustExitGame() == false) { AutoTest::getInstance().updateRoot(program, mainMenu); } else { diff --git a/source/game/menu/menu_state_scenario.cpp b/source/game/menu/menu_state_scenario.cpp index ce7c40068..7cdfa6465 100644 --- a/source/game/menu/menu_state_scenario.cpp +++ b/source/game/menu/menu_state_scenario.cpp @@ -367,7 +367,7 @@ namespace Game { } void MenuStateScenario::update() { - if (Config::getInstance().getBool("AutoTest")) { + if (Config::getInstance().getBool("AutoTest", "false")) { AutoTest::getInstance().updateScenario(this); return; } diff --git a/source/game/world/time_flow.cpp b/source/game/world/time_flow.cpp index d65bb5a6e..a59da70f5 100644 --- a/source/game/world/time_flow.cpp +++ b/source/game/world/time_flow.cpp @@ -51,7 +51,7 @@ namespace Game { time = dawn + 1.5f; lastTime = time; Config &config = Config::getInstance(); - timeInc = 24.f * (1.f / config.getFloat("DayTime")) / GameConstants::updateFps; + timeInc = 24.f * (1.f / config.getFloat("DayTime", "")) / GameConstants::updateFps; //printf("#1 timeInc = %f\n",timeInc); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line %d] timeInc = %f\n", __FILE__, __FUNCTION__, __LINE__, timeInc); diff --git a/source/shared_lib/include/platform/sdl/data_types.h b/source/shared_lib/include/platform/sdl/data_types.h index d5a5c47dc..f24cda59c 100644 --- a/source/shared_lib/include/platform/sdl/data_types.h +++ b/source/shared_lib/include/platform/sdl/data_types.h @@ -90,7 +90,6 @@ typedef Sint64 int64; typedef Uint64 uint64; typedef uint8 byte; -// !!! WINDOWS #else typedef HWND WindowHandle; diff --git a/source/shared_lib/include/platform/sdl/platform_util.h b/source/shared_lib/include/platform/sdl/platform_util.h index 58fd5fbd6..dd3f3eb60 100644 --- a/source/shared_lib/include/platform/sdl/platform_util.h +++ b/source/shared_lib/include/platform/sdl/platform_util.h @@ -71,7 +71,6 @@ namespace Shared { void message(const string &message,bool isNonGraphicalModeEnabled, const string &writepath); void exceptionMessage(const exception &excp); - // WINDOWS #else // ===================================================== diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index 3c3293d8e..f97dcac08 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -409,7 +409,7 @@ namespace Shared { globfree(&globbuf); if (results.empty() == true && errorOnNotFound == true) { - throw game_runtime_error("No files found in: " + mypath); + printf("%s", ("No files found in: " + mypath).c_str()); } if (cutExtension) { diff --git a/source/shared_lib/sources/util/properties.cpp b/source/shared_lib/sources/util/properties.cpp index 3e1748519..e53f03e5e 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()); - printf("%s", "\nFile NOT FOUND, can't open file: [" + path + "]\n"); + printf("%s", ("\nFile NOT FOUND, can't open file: [" + path + "]\n").c_str()); } if (clearCurrentProperties == true) {