diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-10-23 11:13:53 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-10-26 12:28:03 +0200 |
commit | f0f2496a25cedc0cf9076491ccaccab0647e16f5 (patch) | |
tree | 98ad9ea81011d2e9120d4880dc6e2822b48ba781 | |
parent | c6bb66d3bb2d6ee29bd115ccad281c70d7d24177 (diff) | |
download | mana-f0f2496a25cedc0cf9076491ccaccab0647e16f5.tar.gz mana-f0f2496a25cedc0cf9076491ccaccab0647e16f5.tar.bz2 mana-f0f2496a25cedc0cf9076491ccaccab0647e16f5.tar.xz mana-f0f2496a25cedc0cf9076491ccaccab0647e16f5.zip |
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.
-rw-r--r-- | src/client.cpp | 27 | ||||
-rw-r--r-- | src/configuration.cpp | 5 | ||||
-rw-r--r-- | src/configuration.h | 4 | ||||
-rw-r--r-- | src/defaults.cpp | 6 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/chattab.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 2 | ||||
-rw-r--r-- | src/playerrelations.cpp | 3 |
8 files changed, 21 insertions, 38 deletions
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 <sys/stat.h> #include <cassert> -// 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. diff --git a/src/configuration.cpp b/src/configuration.cpp index e37fc1ba..f0499b2d 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -115,9 +115,8 @@ void Configuration::setDefaultValues(DefaultsData *defaultsData) mDefaultsData = defaultsData; } -VariableData* Configuration::getDefault(const std::string &key, - VariableData::DataType type - ) const +VariableData *Configuration::getDefault(const std::string &key, + VariableData::DataType type) const { if (mDefaultsData) { diff --git a/src/configuration.h b/src/configuration.h index 81806ad9..a22eb258 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -245,8 +245,8 @@ class Configuration : public ConfigurationObject bool getBoolValue(const std::string &key) const; - VariableData* getDefault(const std::string &key, - VariableData::DataType type) const; + VariableData *getDefault(const std::string &key, + VariableData::DataType type) const; private: /** * Clean up the default values member. diff --git a/src/defaults.cpp b/src/defaults.cpp index 3c03355a..b17ba350 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -82,11 +82,11 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "screenheight", defaultScreenHeight); AddDEF(configData, "scale", 0); AddDEF(configData, "vsync", true); - AddDEF(configData, "sound", false); + AddDEF(configData, "sound", true); AddDEF(configData, "sfxVolume", 100); AddDEF(configData, "notificationsVolume", 100); AddDEF(configData, "musicVolume", 60); - AddDEF(configData, "remember", false); + AddDEF(configData, "remember", true); AddDEF(configData, "username", ""); AddDEF(configData, "lastCharacter", ""); AddDEF(configData, "fpslimit", 0); @@ -103,7 +103,7 @@ DefaultsData* getConfigDefaults() AddDEF(configData, "logNpcInGui", true); AddDEF(configData, "download-music", false); AddDEF(configData, "guialpha", 0.8f); - AddDEF(configData, "ChatLogLength", 0); + AddDEF(configData, "ChatLogLength", 128); AddDEF(configData, "enableChatLog", false); AddDEF(configData, "whispertab", true); AddDEF(configData, "customcursor", true); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 0d6c9cce..5f7dc7b4 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -397,22 +397,22 @@ void Setup_Video::apply() // If LowCPU is enabled from a disabled state we warn the user else if (mDisableSDLTransparencyCheckBox->isSelected()) { - if (config.getValue("disableTransparency", true) == false) + if (!config.getBoolValue("disableTransparency")) { new OkDialog(_("Transparency disabled"), - _("You must restart to apply changes.")); + _("You must restart to apply changes.")); } } else { - if (config.getValue("disableTransparency", true) == true) + if (config.getBoolValue("disableTransparency")) { new OkDialog(_("Transparency enabled"), - _("You must restart to apply changes.")); + _("You must restart to apply changes.")); } } config.setValue("disableTransparency", - mDisableSDLTransparencyCheckBox->isSelected()); + mDisableSDLTransparencyCheckBox->isSelected()); mFps = mFpsCheckBox->isSelected() ? (int) mFpsSlider->getValue() : 0; mFpsSlider->setEnabled(mFps > 0); diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 9bdb20ef..7a840cc6 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -52,7 +52,7 @@ ChatTab::ChatTab(const std::string &name) mTextOutput = new BrowserBox(BrowserBox::AUTO_WRAP); mTextOutput->setWrapIndent(15); - mTextOutput->setMaxRows((int) config.getIntValue("ChatLogLength")); + mTextOutput->setMaxRows(config.getIntValue("ChatLogLength")); mTextOutput->setLinkHandler(chatWindow->mItemLinkHandler); mScrollArea = new ScrollArea(mTextOutput); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 7e5c9ad9..050e31da 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -407,7 +407,7 @@ void Window::mouseMoved(gcn::MouseEvent &event) int resizeHandles = getResizeHandles(event); - // Changes the custom mouse cursor based on it's current position. + // Changes the custom mouse cursor based on its current position. switch (resizeHandles) { case BOTTOM | RIGHT: diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index f949203e..65b10a8c 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -58,8 +58,7 @@ class PlayerConfSerialiser : public ConfigurationListManager<std::pair<std::stri if (name.empty()) return container; - auto it = - (*container).find(name); + auto it = (*container).find(name); if (it != (*container).end()) { int v = (int)cobj->getValue(RELATION, PlayerRelation::NEUTRAL); |