diff --git a/src/fileio/CParser.cpp b/src/fileio/CParser.cpp index 6487cf343..ca8b02113 100644 --- a/src/fileio/CParser.cpp +++ b/src/fileio/CParser.cpp @@ -65,7 +65,7 @@ bool CParser::saveParseFile() // open, write on the file and close if((fp=OpenGameFile(m_configfile.c_str(),"wt"))) { - for(std::list::iterator i=m_filebuffer.begin() ; i != m_filebuffer.end() ; ++i ) + for(std::list::iterator i = m_filebuffer.begin() ; i != m_filebuffer.end() ; ++i ) fprintf(fp,"%s\n",i->c_str()); fclose(fp); @@ -97,8 +97,8 @@ std::string CParser::getValue(const std::string& keyword, const std::string& cat if(subStrCaseEqual(*line, keyword + " =", keyword.size() + 2)) return line->substr(keyword.size() + 2); } + break; } - break; } } return def; @@ -163,7 +163,7 @@ int CParser::getIntValue(const std::string& keyword, const std::string& category bool fail = false; int v = from_string(str, fail); if(fail) return def; - + return v; } diff --git a/src/main.cpp b/src/main.cpp index c4d43279e..f18718934 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -221,6 +221,8 @@ int main(int argc, char *argv[]) cleanupResources(&CKP); + Settings.saveDrvCfg(); + printf("Thank you very much for playing this wonderful game!"); return 0; diff --git a/src/sdl/CSettings.cpp b/src/sdl/CSettings.cpp index a53b15c49..3272e74c1 100644 --- a/src/sdl/CSettings.cpp +++ b/src/sdl/CSettings.cpp @@ -18,13 +18,11 @@ std::string CONFIGFILENAME = "genius.cfg"; CSettings::CSettings() { - // TODO Auto-generated constructor stub - + notes << "Reading game options from " << GetFullFileName(CONFIGFILENAME) << endl; + notes << "Will write game options to " << GetWriteFullFileName(CONFIGFILENAME, true) << endl; } -CSettings::~CSettings() { - // TODO Auto-generated destructor stub -} +CSettings::~CSettings() {} short CSettings::saveDrvCfg(void) @@ -32,7 +30,14 @@ short CSettings::saveDrvCfg(void) short retval = 0; CParser Parser; + Parser.loadParseFile(); + { + int i = 1; + for(searchpathlist::const_iterator p = tSearchPaths.begin(); p != tSearchPaths.end(); p++, i++) + Parser.saveValue("SearchPath" + itoa(i), "FileHandling", *p); + } + Parser.saveIntValue("bpp","Video",g_pVideoDriver->getDepth()); Parser.saveIntValue("frameskip","Video",g_pVideoDriver->getFrameskip()); @@ -157,16 +162,13 @@ short CSettings::loadGameCfg(stOption *Option) void CSettings::saveGameCfg(stOption *Option) { - int i; CParser Parser; + Parser.loadParseFile(); + + for (int i = 0; i < NUM_OPTIONS; i++) + Parser.saveIntValue(Option[i].name,"Game",Option[i].value); - if(Parser.loadParseFile()) - { - for (i = 0; i < NUM_OPTIONS; i++) - Parser.saveIntValue(Option[i].name,"Game",Option[i].value); - - Parser.saveParseFile(); - } + Parser.saveParseFile(); return; } diff --git a/src/sdl/CVideoDriver.cpp b/src/sdl/CVideoDriver.cpp index 9c8557f30..1b7e9a5bc 100644 --- a/src/sdl/CVideoDriver.cpp +++ b/src/sdl/CVideoDriver.cpp @@ -275,15 +275,14 @@ bool CVideoDriver::applyMode(void) // And Display can be setup. screen = SDL_SetVideoMode(m_Resolution.width,m_Resolution.height,m_Resolution.depth,Mode); - m_Resolution.depth = screen->format->BitsPerPixel; - - if( !screen ) { g_pLogFile->textOut(RED,"VidDrv_Start(): Couldn't create a SDL surface: %s
", SDL_GetError()); return false; } + m_Resolution.depth = screen->format->BitsPerPixel; + if(!Fullscreen) SDL_ShowCursor(SDL_ENABLE); else