Fixed various FIXMEs by using a constant instead of hardcoding a value, + removed a bit of old code

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4201 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-11-03 19:58:26 +00:00
parent ef77d9906b
commit bed61da8a6
7 changed files with 13 additions and 33 deletions

View File

@ -311,19 +311,6 @@ void EventHandler::processAction(const int action, const unsigned int value, Inp
// FIXME : consider returned value?
onWidgetActivated( w, playerID );
}
/*
// simulate a 'enter' key press
irr::SEvent::SKeyInput evt;
evt.PressedDown = pressedDown;
evt.Key = KEY_SPACE; // FIXME : what if keyboard bindings are not set to use this key?
evt.Char = 666; // My magic code to know it's a fake event (FIXME : ugly, but irrlicht doesn't seem to offer better)
irr::SEvent wrapper;
wrapper.KeyInput = evt;
wrapper.EventType = EET_KEY_INPUT_EVENT;
GUIEngine::getDevice()->postEventFromUser(wrapper);
*/
break;
default:
return;

View File

@ -28,6 +28,7 @@
#include "guiengine/modaldialog.hpp"
#include "guiengine/screen.hpp"
#include "guiengine/widget.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/translation.hpp"
using namespace irr;
@ -266,10 +267,10 @@ void Screen::addWidgets()
//std::cout << "*****ScreenAddWidgets " << m_filename.c_str() << " : focusing the first widget*****\n";
// select the first widget
// select the first widget (for first players only; if other players need some focus the Screen must provide it).
Widget* w = getFirstWidget();
//std::cout << "First widget is " << (w == NULL ? "null" : w->m_properties[PROP_ID].c_str()) << std::endl;
if (w != NULL) w->setFocusForPlayer( 0 ); // FIXME: don't hardcode player ID 0
if (w != NULL) w->setFocusForPlayer( GUI_PLAYER_ID );
else std::cerr << "Couldn't select first widget, NULL was returned\n";
}
// -----------------------------------------------------------------------------

View File

@ -19,8 +19,9 @@
#include "config/player.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/widget.hpp"
#include "states_screens/options_screen_players.hpp"
#include "states_screens/dialogs/player_info_dialog.hpp"
#include "states_screens/options_screen_players.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/string_utils.hpp"
#include "utils/translation.hpp"
@ -112,8 +113,7 @@ void PlayerInfoDialog::showRegularDialog()
widget->add();
}
const int playerID = 0; // FIXME: don't hardcode player ID
textCtrl->setFocusForPlayer( playerID );
textCtrl->setFocusForPlayer( GUI_PLAYER_ID );
}
// ------------------------------------------------------------------------------------------------------
void PlayerInfoDialog::showConfirmDialog()
@ -174,8 +174,7 @@ void PlayerInfoDialog::showConfirmDialog()
m_children.push_back(widget);
widget->add();
const int playerID = 0; // FIXME: don't hardcode player ID
widget->setFocusForPlayer( playerID );
widget->setFocusForPlayer( GUI_PLAYER_ID );
}
}

View File

@ -67,8 +67,7 @@ RacePausedDialog::RacePausedDialog(const float percentWidth, const float percent
m_children.push_back(back_btn);
back_btn->add();
const int playerID = 0; // FIXME: don't hardcode player ID
back_btn->setFocusForPlayer( playerID );
back_btn->setFocusForPlayer( GUI_PLAYER_ID );
// ---- Choice ribbon
m_choice_ribbon = new RibbonWidget(RIBBON_TOOLBAR);
@ -229,9 +228,7 @@ GUIEngine::EventPropagation RacePausedDialog::processEvent(std::string& eventSou
}
else if (eventSource == "choiceribbon")
{
// FIXME : don't hardcode player 0
const int playerId = 0;
const std::string& selection = m_choice_ribbon->getSelectionIDString(playerId);
const std::string& selection = m_choice_ribbon->getSelectionIDString(GUI_PLAYER_ID);
std::cout << "RacePausedDialog::processEvent(" << eventSource.c_str() << " : " << selection << ")\n";

View File

@ -82,8 +82,7 @@ TrackInfoDialog::TrackInfoDialog(const std::string& trackIdent, const irr::core:
okBtn->getIrrlichtElement()->setTabStop(true);
okBtn->getIrrlichtElement()->setTabGroup(false);
const int playerID = 0; // FIXME: don't hardcode
okBtn->setFocusForPlayer( playerID );
okBtn->setFocusForPlayer( GUI_PLAYER_ID );
// ---- Track title
core::rect< s32 > area_top(0, 0, m_area.getWidth(), y1);

View File

@ -126,8 +126,7 @@ void OptionsScreenAV::init()
{
//std::cout << "************* Detected right resolution!!! " << n << "\n";
// that's the current one
const int playerID = 0; // FIXME: don't hardcode player 0 ?
res->setSelection(n, playerID, false);
res->setSelection(n, GUI_PLAYER_ID, false);
break;
}
} // end for

View File

@ -126,8 +126,7 @@ void OptionsScreenInput::init()
// trigger displaying bindings for default selected device
const std::string name2("devices");
const int playerID = 0; // FIXME : don't hardcode player ID
eventCallback(devices, name2, playerID);
eventCallback(devices, name2, GUI_PLAYER_ID);
}
// -----------------------------------------------------------------------------
@ -223,8 +222,7 @@ void OptionsScreenInput::gotSensedInput(Input* sensedInput)
// re-select the previous button
ButtonWidget* btn = this->getWidget<ButtonWidget>(binding_to_set_button.c_str());
const int playerID = 0; // FIXME: don't hardcode player ID
if(btn != NULL) btn->setFocusForPlayer(playerID);
if(btn != NULL) btn->setFocusForPlayer(GUI_PLAYER_ID);
// save new binding to file
input_manager->getDeviceList()->serialize();