Fixed bug 2547586 (keys lock after pause): keys pressed when the

in-game menu is called would still considered to be pressed
when the game is continued.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@3085 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2009-01-31 04:51:50 +00:00
parent 999c7c7ab5
commit 4b907c643a
3 changed files with 19 additions and 2 deletions

View File

@@ -75,6 +75,20 @@ void PlayerKart::reset()
m_camera->reset();
} // reset
// ----------------------------------------------------------------------------
/** Resets the state of control keys. This is used after the in-game menu to
* avoid that any keys pressed at the time the menu is opened are still
* considered to be pressed.
*/
void PlayerKart::resetInputState()
{
m_steer_val_l = 0;
m_steer_val_r = 0;
m_steer_val = 0;
m_prev_brake = 0;
m_prev_accel = 0;
} // resetKeyState
// ----------------------------------------------------------------------------
/** This function interprets a kart action and value, and set the corresponding
* entries in the kart control data structure. This function handles esp.

View File

@@ -63,10 +63,11 @@ public:
virtual void crashed (Kart *k);
virtual void setPosition (int p);
virtual void raceFinished (float time);
virtual void doingShortcut();
virtual void doingShortcut ();
bool isPlayerKart () const {return true;}
Camera* getCamera () {return m_camera;}
void reset();
void reset ();
void resetInputState ();
};
#endif

View File

@@ -549,6 +549,8 @@ void World::unpause()
sound_manager->resumeMusic() ;
sfx_manager->resumeAll();
TimedRace::unpause();
for(unsigned int i=0; i<m_player_karts.size(); i++)
m_player_karts[i]->resetInputState();
}
/* EOF */