X-Git-Url: https://git.jsancho.org/?p=lugaru.git;a=blobdiff_plain;f=Source%2FUser%2FSettings.cpp;fp=Source%2FUser%2FSettings.cpp;h=4890f45f1d7c883f302b03b0314c929d001b4753;hp=fedc77e5bc328b0b8567312f5597177e5c39316d;hb=4dfbee7192000c0047a73d48fb10a33d39261d89;hpb=a8e0e96af3222c42663b3c60158caed20ac46829 diff --git a/Source/User/Settings.cpp b/Source/User/Settings.cpp index fedc77e..4890f45 100644 --- a/Source/User/Settings.cpp +++ b/Source/User/Settings.cpp @@ -76,16 +76,10 @@ void SaveSettings() if (newdetail > 2) { newdetail = 2; } - if (newscreenwidth > 3000) { + if (newscreenwidth < minscreenwidth || newscreenwidth > maxscreenwidth) { newscreenwidth = screenwidth; } - if (newscreenwidth < 0) { - newscreenwidth = screenwidth; - } - if (newscreenheight > 3000) { - newscreenheight = screenheight; - } - if (newscreenheight < 0) { + if (newscreenheight < minscreenheight || newscreenheight > maxscreenheight) { newscreenheight = screenheight; } errno = 0; @@ -207,8 +201,14 @@ bool LoadSettings() if (!strncmp(setting, "Screenwidth", 11)) { ipstream >> kContextWidth; + if (kContextWidth < (int)minscreenwidth || kContextWidth > (int)maxscreenwidth) { + kContextWidth = (int)minscreenwidth; + } } else if (!strncmp(setting, "Screenheight", 12)) { ipstream >> kContextHeight; + if (kContextHeight < (int)minscreenheight || kContextHeight > (int)maxscreenheight) { + kContextHeight = (int)minscreenheight; + } } else if (!strncmp(setting, "Fullscreen", 10)) { ipstream >> fullscreen; } else if (!strncmp(setting, "Mouse sensitivity", 17)) { @@ -316,10 +316,10 @@ bool LoadSettings() if (detail < 0) { detail = 0; } - if (screenwidth < 0) { + if (screenwidth < minscreenwidth || screenwidth > maxscreenwidth) { screenwidth = 1024; } - if (screenheight < 0) { + if (screenheight < minscreenheight || screenheight > maxscreenheight) { screenheight = 768; }