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:
parent
d8864f3f71
commit
5050603f9e
@ -71,12 +71,20 @@ ConfigDisplay::ConfigDisplay()
|
|||||||
changeResolution(user_config->m_prev_width,
|
changeResolution(user_config->m_prev_width,
|
||||||
user_config->m_prev_height,true);
|
user_config->m_prev_height,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if m_prev_windowed is true and m_fullscreen is true then a change to
|
// if m_prev_windowed is true and m_fullscreen is true then a change to
|
||||||
// fullscreen has been rejected
|
// 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();
|
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;
|
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_width = width;
|
||||||
user_config->m_height = height;
|
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)
|
if (!reverse && user_config->m_fullscreen)
|
||||||
{
|
{
|
||||||
// Store settings in user config file in case new video mode
|
// Store settings in user config file in case new video mode
|
||||||
|
@ -71,10 +71,6 @@ GameMode::GameMode()
|
|||||||
|
|
||||||
widget_manager->layout(WGT_AREA_ALL);
|
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -496,9 +496,7 @@ int main(int argc, char *argv[] )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Program closing...*/
|
/* Program closing...*/
|
||||||
// Set crashed flag to false
|
|
||||||
user_config->m_crashed = false;
|
|
||||||
|
|
||||||
user_config->saveConfig();
|
user_config->saveConfig();
|
||||||
|
|
||||||
drv_deinit();
|
drv_deinit();
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "input.hpp"
|
#include "input.hpp"
|
||||||
#include "actionmap.hpp"
|
#include "actionmap.hpp"
|
||||||
@ -85,10 +86,15 @@ void drv_init()
|
|||||||
user_config->m_crashed = false; //reset flag
|
user_config->m_crashed = false; //reset flag
|
||||||
// set window mode as a precaution
|
// set window mode as a precaution
|
||||||
user_config->m_fullscreen = false;
|
user_config->m_fullscreen = false;
|
||||||
// blacklist the res
|
// blacklist the res if not already done
|
||||||
std::ostringstream o;
|
std::ostringstream o;
|
||||||
o << user_config->m_width << "x" << user_config->m_height;
|
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
|
//use prev screen res settings if available
|
||||||
if (user_config->m_width != user_config->m_prev_width
|
if (user_config->m_width != user_config->m_prev_width
|
||||||
|| user_config->m_height != user_config->m_prev_height)
|
|| user_config->m_height != user_config->m_prev_height)
|
||||||
|
Loading…
Reference in New Issue
Block a user