From f0f2496a25cedc0cf9076491ccaccab0647e16f5 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 23 Oct 2024 11:13:53 +0200 Subject: Fixed FPS limit being enabled by default There were some inconsistencies between the values set up in `Client::initConfiguration` and those in `getConfigDefaults`. These duplicates have now been removed. For some of these settings the code getting the values had to be adjusted to use getBoolValue, to actually rely on the provided default instead of one provided as a parameter. --- src/client.cpp | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index f428aaec..fba54c81 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -87,7 +87,7 @@ #include #include -// TODO: Get rid fo these globals +// TODO: Get rid of these globals std::string errorMessage; LoginData loginData; @@ -262,10 +262,10 @@ Client::Client(const Options &options): // Add the local data directory to PhysicsFS search path resman->addToSearchPath(mLocalDataDir, false); - bool useOpenGL = !mOptions.noOpenGL && (config.getValue("opengl", 0) == 1); + bool useOpenGL = !mOptions.noOpenGL && config.getBoolValue("opengl"); // Set up the transparency option for low CPU when not using OpenGL. - if (!useOpenGL && (config.getValue("disableTransparency", 0) == 1)) + if (!useOpenGL && config.getBoolValue("disableTransparency")) Image::SDLdisableTransparency(); VideoSettings videoSettings; @@ -394,10 +394,7 @@ Client::Client(const Options &options): listen(Event::ConfigChannel); - //TODO: fix having to fake a option changed event - Event fakeevent(Event::ConfigOptionChanged); - fakeevent.setString("option", "fpslimit"); - event(Event::ConfigChannel, fakeevent); + mFpsLimit = config.getIntValue("fpslimit"); // Initialize PlayerInfo PlayerInfo::init(); @@ -1105,20 +1102,8 @@ void Client::initHomeDir() void Client::initConfiguration() { // Fill configuration with defaults - config.setValue("opengl", false); - config.setValue("screen", false); - config.setValue("sound", true); - config.setValue("guialpha", 0.8f); - config.setValue("remember", true); - config.setValue("sfxVolume", 100); - config.setValue("musicVolume", 60); - config.setValue("fpslimit", 60); - std::string defaultUpdateHost = branding.getValue("defaultUpdateHost", ""); - config.setValue("updatehost", defaultUpdateHost); - config.setValue("customcursor", true); - config.setValue("useScreenshotDirectorySuffix", true); - config.setValue("ChatLogLength", 128); - config.setValue("disableTransparency", false); + config.setValue("updatehost", branding.getValue("defaultUpdateHost", + std::string())); // Checking if the configuration file exists... otherwise create it with // default options. -- cgit v1.2.3-70-g09d2