Fixed input mode not properly reset when exiting race

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4253 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-12-06 16:06:39 +00:00
parent 1e4ede71ff
commit a5edabee75
2 changed files with 45 additions and 42 deletions

View File

@ -604,58 +604,60 @@ void InputManager::setMode(InputDriverMode new_mode)
{
case MENU:
switch (m_mode)
{
case INGAME:
// Leaving ingame mode.
{
case INGAME:
// Leaving ingame mode.
//if (m_action_map)
// delete m_action_map;
//if (m_action_map)
// delete m_action_map;
// Reset the helper values for the relative mouse movement
// supresses to the notification of them as an input.
m_mouse_val_x = m_mouse_val_y = 0;
// Reset the helper values for the relative mouse movement
// supresses to the notification of them as an input.
m_mouse_val_x = m_mouse_val_y = 0;
irr_driver->showPointer();
irr_driver->showPointer();
m_device_manager->setAssignMode(NO_ASSIGN);
// Fall through expected.
case BOOTSTRAP:
// Leaving boot strap mode.
// Fall through expected.
case BOOTSTRAP:
// Leaving boot strap mode.
// Installs the action map for the menu.
// m_action_map = UserConfigParams::newMenuActionMap();
// Installs the action map for the menu.
// m_action_map = UserConfigParams::newMenuActionMap();
m_mode = MENU;
m_mode = MENU;
m_device_manager->setAssignMode(NO_ASSIGN);
break;
case INPUT_SENSE_KEYBOARD:
case INPUT_SENSE_GAMEPAD:
// Leaving input sense mode.
break;
case INPUT_SENSE_KEYBOARD:
case INPUT_SENSE_GAMEPAD:
// Leaving input sense mode.
irr_driver->showPointer();
m_sensed_input_on_all_axes.clear();
irr_driver->showPointer();
m_sensed_input_on_all_axes.clear();
// The order is deliberate just in case someone starts to make
// STK multithreaded: m_sensed_input must not be 0 when
// mode == INPUT_SENSE_PREFER_{AXIS,BUTTON}.
m_mode = MENU;
// The order is deliberate just in case someone starts to make
// STK multithreaded: m_sensed_input must not be 0 when
// mode == INPUT_SENSE_PREFER_{AXIS,BUTTON}.
m_mode = MENU;
delete m_sensed_input;
m_sensed_input = 0;
delete m_sensed_input;
m_sensed_input = 0;
break;
case LOWLEVEL:
// Leaving lowlevel mode.
irr_driver->showPointer();
break;
case LOWLEVEL:
// Leaving lowlevel mode.
irr_driver->showPointer();
m_mode = MENU;
break;
default:
;
// Something is broken.
//assert (false);
}
m_mode = MENU;
break;
default:
;
// Something is broken.
//assert (false);
}
break;
case INGAME:
// We must be in menu mode now in order to switch.

View File

@ -318,7 +318,7 @@ void RaceManager::exitRace()
{
// Only display the grand prix result screen if all tracks
// were finished, and not when a race is aborted.
if(m_major_mode==MAJOR_MODE_GRAND_PRIX && m_track_number==(int)m_tracks.size())
if (m_major_mode==MAJOR_MODE_GRAND_PRIX && m_track_number==(int)m_tracks.size())
{
// calculate the rank of each kart
const unsigned int NUM_KARTS = race_manager->getNumKarts();
@ -328,14 +328,14 @@ void RaceManager::exitRace()
double *race_time = new double[NUM_KARTS];
// Ignore the first kart if it's a follow-the-leader race.
int start=(race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER) ? 1 : 0;
for( unsigned int kart_id = start; kart_id < NUM_KARTS; ++kart_id )
for (unsigned int kart_id = start; kart_id < NUM_KARTS; ++kart_id)
{
position[kart_id] = kart_id;
scores[kart_id] = race_manager->getKartScore(kart_id);
race_time[kart_id] = race_manager->getOverallTime(kart_id);
}
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER)
if (race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER)
{
// fill values for leader
position[0] = -1;
@ -395,6 +395,7 @@ void RaceManager::exitRace()
m_active_race = false;
StateManager::get()->resetActivePlayers();
input_manager->getDeviceList()->setAssignMode(NO_ASSIGN);
} // exitRace
//-----------------------------------------------------------------------------