]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Settings.cpp
Add copyright header to source files to match license for project
[lugaru.git] / Source / Settings.cpp
index 9b99459ad3f8d70eb3830be0020e24457a7e0041..9f73038c733732454058e25dcc9c6882ef14348f 100644 (file)
@@ -1,3 +1,24 @@
+/*
+Copyright (C) 2003, 2010 - Wolfire Games
+
+This file is part of Lugaru.
+
+Lugaru is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+*/
+
 #include "Settings.h"
 #include "Game.h"
 #include "Input.h"
@@ -49,12 +70,18 @@ void DefaultSettings()
 
 void SaveSettings()
 {
-    if (newdetail < 0) newdetail = 0;
-    if (newdetail > 2) newdetail = 2;
-    if (newscreenwidth > 3000) newscreenwidth = screenwidth;
-    if (newscreenwidth < 0) newscreenwidth = screenwidth;
-    if (newscreenheight > 3000) newscreenheight = screenheight;
-    if (newscreenheight < 0) newscreenheight = screenheight;
+    if (newdetail < 0)
+        newdetail = 0;
+    if (newdetail > 2)
+        newdetail = 2;
+    if (newscreenwidth > 3000)
+        newscreenwidth = screenwidth;
+    if (newscreenwidth < 0)
+        newscreenwidth = screenwidth;
+    if (newscreenheight > 3000)
+        newscreenheight = screenheight;
+    if (newscreenheight < 0)
+        newscreenheight = screenheight;
     ofstream opstream(ConvertFileName(":Data:config.txt", "w"));
     opstream << "Screenwidth:\n";
     opstream << newscreenwidth;
@@ -87,7 +114,8 @@ void SaveSettings()
     opstream << "\nInvert mouse:\n";
     opstream << invertmouse;
     opstream << "\nGamespeed:\n";
-    if (oldgamespeed == 0)oldgamespeed = 1;
+    if (oldgamespeed == 0)
+        oldgamespeed = 1;
     opstream << oldgamespeed;
     opstream << "\nDifficulty(0,1,2) higher=harder:\n";
     opstream << difficulty;
@@ -158,7 +186,8 @@ bool LoadSettings()
 
         // skip blank lines
         // assume lines starting with spaces are all blank
-        if ( strlen(setting) == 0 || setting[0] == ' ' || setting[0] == '\t') continue;
+        if ( strlen(setting) == 0 || setting[0] == ' ' || setting[0] == '\t')
+            continue;
         //~ printf("setting : %s\n",setting);
 
         if ( ipstream.eof() || ipstream.fail() ) {
@@ -178,8 +207,10 @@ bool LoadSettings()
             ipstream >> ismotionblur;
         } else if ( !strncmp(setting, "Overall Detail", 14) ) {
             ipstream >> detail;
-            if (detail != 0)kBitsPerPixel = 32;
-            else kBitsPerPixel = 16;
+            if (detail != 0)
+                kBitsPerPixel = 32;
+            else
+                kBitsPerPixel = 16;
         } else if ( !strncmp(setting, "Floating jump", 13) ) {
             ipstream >> floatjump;
         } else if ( !strncmp(setting, "Mouse jump", 10) ) {
@@ -290,10 +321,14 @@ bool LoadSettings()
 
     ipstream.close();
 
-    if (detail > 2)detail = 2;
-    if (detail < 0)detail = 0;
-    if (screenwidth < 0)screenwidth = 640;
-    if (screenheight < 0)screenheight = 480;
+    if (detail > 2)
+        detail = 2;
+    if (detail < 0)
+        detail = 0;
+    if (screenwidth < 0)
+        screenwidth = 640;
+    if (screenheight < 0)
+        screenheight = 480;
 
     return true;
 }