From 0ccfa64a7dbde1e5dba3ee28e1cebb724ea86bbc Mon Sep 17 00:00:00 2001 From: "John B. Messerly" Date: Sat, 8 May 2004 19:39:43 +0000 Subject: [PATCH] Wesnoth now stores two resolutions: one for fullscreen and one for windowed mode. When you switch to/from fullscreen mode, it sets your resolution appropriately. The old xresolution= and yresoltion= tags from ~/.wesnoth/preferences are ignored, so this requires a one time setting-up of resolutions. --- src/preferences.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/preferences.cpp b/src/preferences.cpp index 3d6e19186c2..d1b8c4bac5c 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -111,8 +111,9 @@ void set_fullscreen(bool ison) std::pair resolution() { - const string_map::const_iterator x = prefs.values.find("xresolution"); - const string_map::const_iterator y = prefs.values.find("yresolution"); + const std::string prefix = fullscreen() ? "fullscreen_" : "windowed_"; + const string_map::const_iterator x = prefs.values.find(prefix + "xres"); + const string_map::const_iterator y = prefs.values.find(prefix + "yres"); if(x != prefs.values.end() && y != prefs.values.end() && x->second.empty() == false && y->second.empty() == false) { std::pair res (maximum(atoi(x->second.c_str()),800), @@ -152,11 +153,9 @@ void set_resolution(const std::pair& resolution) } if(write_resolution) { - char buf[50]; - sprintf(buf,"%d",res.first); - prefs["xresolution"] = buf; - sprintf(buf,"%d",res.second); - prefs["yresolution"] = buf; + const std::string prefix = fullscreen() ? "fullscreen_" : "windowed_"; + prefs[prefix + "xres"] = lexical_cast(res.first); + prefs[prefix + "yres"] = lexical_cast(res.second); } }