From: <au...@us...> - 2009-12-27 18:41:26
|
Revision: 4354 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4354&view=rev Author: auria Date: 2009-12-27 18:41:19 +0000 (Sun, 27 Dec 2009) Log Message: ----------- Fixed input bug that occurred when going back in menus Modified Paths: -------------- main/trunk/src/guiengine/abstract_state_manager.cpp main/trunk/src/input/device_manager.cpp main/trunk/src/input/input_manager.cpp Modified: main/trunk/src/guiengine/abstract_state_manager.cpp =================================================================== --- main/trunk/src/guiengine/abstract_state_manager.cpp 2009-12-27 17:02:15 UTC (rev 4353) +++ main/trunk/src/guiengine/abstract_state_manager.cpp 2009-12-27 18:41:19 UTC (rev 4354) @@ -165,7 +165,6 @@ { m_game_mode = MENU; switchToScreen(m_menu_stack[m_menu_stack.size()-1].c_str()); - input_manager->getDeviceList()->setAssignMode(NO_ASSIGN); // No assign mode on menus by default getCurrentScreen()->init(); } } Modified: main/trunk/src/input/device_manager.cpp =================================================================== --- main/trunk/src/input/device_manager.cpp 2009-12-27 17:02:15 UTC (rev 4353) +++ main/trunk/src/input/device_manager.cpp 2009-12-27 18:41:19 UTC (rev 4354) @@ -10,6 +10,8 @@ #include "states_screens/state_manager.hpp" #include "io/file_manager.hpp" +#define INPUT_MODE_DEBUG 0 + DeviceManager::DeviceManager() { m_latest_used_device = NULL; @@ -89,6 +91,12 @@ { m_assign_mode = assignMode; +#if INPUT_MODE_DEBUG + if (assignMode == NO_ASSIGN) std::cout << "====== DeviceManager::setAssignMode(NO_ASSIGN) ======\n"; + if (assignMode == ASSIGN) std::cout << "====== DeviceManager::setAssignMode(ASSIGN) ======\n"; + if (assignMode == DETECT_NEW) std::cout << "====== DeviceManager::setAssignMode(DETECT_NEW) ======\n"; +#endif + // when going back to no-assign mode, do some cleanup if (assignMode == NO_ASSIGN) { @@ -262,7 +270,7 @@ if (m_latest_used_device == NULL) { - std::cout<< "========== No latest device, returning keyboard ==========\n"; + //std::cout<< "========== No latest device, returning keyboard ==========\n"; return m_keyboards.get(0); // FIXME: is this right? } Modified: main/trunk/src/input/input_manager.cpp =================================================================== --- main/trunk/src/input/input_manager.cpp 2009-12-27 17:02:15 UTC (rev 4353) +++ main/trunk/src/input/input_manager.cpp 2009-12-27 18:41:19 UTC (rev 4354) @@ -49,6 +49,8 @@ using GUIEngine::EVENT_LET; using GUIEngine::EVENT_BLOCK; +#define INPUT_MODE_DEBUG 0 + //----------------------------------------------------------------------------- /** Initialise input */ @@ -397,6 +399,9 @@ //----------------------------------------------------------------------------- void InputManager::setMasterPlayerOnly(bool enabled) { +#if INPUT_MODE_DEBUG + std::cout << "====== InputManager::setMasterPlayerOnly(" << enabled << ") ======\n"; +#endif m_master_player_only = enabled; } /** Returns whether only the master player should be allowed to perform changes in menus */ @@ -616,6 +621,9 @@ switch (new_mode) { case MENU: +#if INPUT_MODE_DEBUG + std::cout << "====== InputManager::setMode(MENU) ======\n"; +#endif switch (m_mode) { case INGAME: @@ -673,6 +681,9 @@ break; case INGAME: +#if INPUT_MODE_DEBUG + std::cout << "====== InputManager::setMode(INGAME) ======\n"; +#endif // We must be in menu mode now in order to switch. assert (m_mode == MENU); @@ -689,6 +700,9 @@ break; case INPUT_SENSE_KEYBOARD: case INPUT_SENSE_GAMEPAD: +#if INPUT_MODE_DEBUG + std::cout << "====== InputManager::setMode(INPUT_SENSE_*) ======\n"; +#endif // We must be in menu mode now in order to switch. assert (m_mode == MENU); @@ -705,6 +719,9 @@ break; case LOWLEVEL: +#if INPUT_MODE_DEBUG + std::cout << "====== InputManager::setMode(LOWLEVEL) ======\n"; +#endif // We must be in menu mode now in order to switch. assert (m_mode == MENU); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |