Added an additional check to ensure a resolution is not blacklisted

twice.
Re-seperated crash detection from kill 'detection' (see next).
Added additional saveConfig() calls to ensure that the correct current 
and previous resolutions are stored in the event of the game being 
killed.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1442 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
scifly 2008-02-04 14:28:44 +00:00
parent d8864f3f71
commit 5050603f9e
4 changed files with 26 additions and 11 deletions

View File

@ -71,12 +71,20 @@ ConfigDisplay::ConfigDisplay()
changeResolution(user_config->m_prev_width,
user_config->m_prev_height,true);
}
// if m_prev_windowed is true and m_fullscreen is true then a change to
// fullscreen has been rejected
if (user_config->m_prev_windowed && user_config->m_fullscreen)
else if (user_config->m_prev_windowed && user_config->m_fullscreen)
{
drv_toggleFullscreen();
user_config->m_prev_windowed = false; //reset flag
user_config->m_prev_windowed = false; //reset flags
user_config->m_crashed = false;
user_config->saveConfig();
}
else
{
user_config->m_crashed = false; //if we are here we didn't crash
user_config->saveConfig();
}
const bool SHOW_RECT = true;
@ -300,6 +308,13 @@ void ConfigDisplay::changeResolution(int width, int height, bool reverse)
user_config->m_width = width;
user_config->m_height = height;
// if returning to prev res, change m_crashed to false as we didn't crash and save config
if (reverse && user_config->m_fullscreen)
{
user_config->m_crashed = false;
user_config->saveConfig();
}
if (!reverse && user_config->m_fullscreen)
{
// Store settings in user config file in case new video mode

View File

@ -71,10 +71,6 @@ GameMode::GameMode()
widget_manager->layout(WGT_AREA_ALL);
// Set crashed flag to false, as if made it here after chaging res
// then can't have crashed or been killed
user_config->m_crashed = false;
user_config->saveConfig();
}
//-----------------------------------------------------------------------------

View File

@ -496,8 +496,6 @@ int main(int argc, char *argv[] )
}
/* Program closing...*/
// Set crashed flag to false
user_config->m_crashed = false;
user_config->saveConfig();

View File

@ -23,6 +23,7 @@
#include <string>
#include <iostream>
#include <sstream>
#include <algorithm>
#include "input.hpp"
#include "actionmap.hpp"
@ -85,10 +86,15 @@ void drv_init()
user_config->m_crashed = false; //reset flag
// set window mode as a precaution
user_config->m_fullscreen = false;
// blacklist the res
// blacklist the res if not already done
std::ostringstream o;
o << user_config->m_width << "x" << user_config->m_height;
user_config->m_blacklist_res.push_back (o.str());
std::string res = o.str();
if (std::find(user_config->m_blacklist_res.begin(),
user_config->m_blacklist_res.end(),res) == user_config->m_blacklist_res.end())
{
user_config->m_blacklist_res.push_back (o.str());
}
//use prev screen res settings if available
if (user_config->m_width != user_config->m_prev_width
|| user_config->m_height != user_config->m_prev_height)