Fixed bug 3090931: in some circumstances the key bindings for
the 2nd player would become the default, so if the first player presses 'select' to select a kart, instead a new kart was added. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6738 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -341,6 +341,12 @@ InputDevice* DeviceManager::getLatestUsedDevice()
|
||||
|
||||
return m_latest_used_device;
|
||||
}
|
||||
// -----------------------------------------------------------------------------
|
||||
void DeviceManager::clearLatestUsedDevice()
|
||||
{
|
||||
m_latest_used_device = NULL;
|
||||
} // clearLatestUsedDevice
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
bool DeviceManager::deserialize()
|
||||
{
|
||||
|
||||
@@ -126,6 +126,7 @@ public:
|
||||
StateManager::ActivePlayer** player /* out */,
|
||||
PlayerAction* action /* out */ );
|
||||
|
||||
void clearLatestUsedDevice();
|
||||
InputDevice* getLatestUsedDevice();
|
||||
bool initialize();
|
||||
void serialize();
|
||||
|
||||
@@ -100,6 +100,19 @@ void MainMenuScreen::init()
|
||||
StateManager::get()->resetActivePlayers();
|
||||
input_manager->getDeviceList()->setAssignMode(NO_ASSIGN);
|
||||
input_manager->setMasterPlayerOnly(false);
|
||||
|
||||
// Avoid incorrect behaviour in certain race circumstances:
|
||||
// If a multi-player game is played with two keyboards, the 2nd
|
||||
// player selects his kart last, and only the keyboard is used
|
||||
// to select all other settings - then if the next time the kart
|
||||
// selection screen comes up, the default device will still be
|
||||
// the 2nd player. So if the first player presses 'select', it
|
||||
// will instead add a second player (so basically the key
|
||||
// binding for the second player become the default, so pressing
|
||||
// select will add a new player). See bug 3090931
|
||||
// To avoid this, we will clean the last used device, making
|
||||
// the key bindings for the first player the default again.
|
||||
input_manager->getDeviceList()->clearLatestUsedDevice();
|
||||
|
||||
#ifdef ADDONS_MANAGER
|
||||
// FIXME: this is wrong, init may be called several times in the object's
|
||||
|
||||
Reference in New Issue
Block a user