Fixed several FIXMEs related to player ID

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5136 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2010-04-08 21:02:40 +00:00
parent 562f3489ec
commit d1df9b1ee1
26 changed files with 69 additions and 72 deletions

View File

@ -315,7 +315,7 @@ void Screen::addWidgets()
// 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( GUI_PLAYER_ID );
if (w != NULL) w->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
else std::cerr << "Couldn't select first widget, NULL was returned\n";
}
// -----------------------------------------------------------------------------

View File

@ -651,13 +651,13 @@ void Skin::drawRibbonChild(const core::rect< s32 > &rect, Widget* widget, const
// we ever need to...
if (widget->m_deactivated) return;
bool mark_selected = widget->isSelected(GUI_PLAYER_ID);
bool mark_selected = widget->isSelected(PLAYER_ID_GAME_MASTER);
bool always_show_selection = false;
IGUIElement* focusedElem = NULL;
if (GUIEngine::getFocusForPlayer(GUI_PLAYER_ID) != NULL)
if (GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER) != NULL)
{
focusedElem = GUIEngine::getFocusForPlayer(GUI_PLAYER_ID)->getIrrlichtElement();
focusedElem = GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER)->getIrrlichtElement();
}
const bool parent_focused = (focusedElem == widget->m_event_handler->m_element);
@ -1229,7 +1229,7 @@ void Skin::draw2DRectangle (IGUIElement *element, const video::SColor &color, co
if (type == WTYPE_LIST)
{
// lists not supported in multiplayer screens
const bool focused = GUIEngine::isFocusedForPlayer(widget, GUI_PLAYER_ID);
const bool focused = GUIEngine::isFocusedForPlayer(widget, PLAYER_ID_GAME_MASTER);
drawListSelection(rect, widget, focused);
}
@ -1260,7 +1260,7 @@ void Skin::process3DPane(IGUIElement *element, const core::rect< s32 > &rect, co
return;
}
const bool focused = GUIEngine::isFocusedForPlayer(widget, GUI_PLAYER_ID);
const bool focused = GUIEngine::isFocusedForPlayer(widget, PLAYER_ID_GAME_MASTER);
/*
std::cout << "Skin (3D Pane) : " << (widget == NULL ? "NULL!!" : widget->m_properties[PROP_ID].c_str())
@ -1412,9 +1412,9 @@ void Skin::draw3DSunkenPane (IGUIElement *element, video::SColor bgcolor, bool f
const WidgetType type = widget->m_type;
IGUIElement* focusedElem = NULL;
if (GUIEngine::getFocusForPlayer(GUI_PLAYER_ID) != NULL)
if (GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER) != NULL)
{
focusedElem = GUIEngine::getFocusForPlayer(GUI_PLAYER_ID)->getIrrlichtElement();
focusedElem = GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER)->getIrrlichtElement();
}
const bool focused = (focusedElem == element);

View File

@ -631,7 +631,7 @@ void DynamicRibbonWidget::updateLabel(RibbonWidget* from_this_ribbon)
if (!m_has_label) return;
// only the master player can update the label
const int playerID = GUI_PLAYER_ID;
const int playerID = PLAYER_ID_GAME_MASTER;
RibbonWidget* row = from_this_ribbon ? from_this_ribbon : (RibbonWidget*)getSelectedRibbon(playerID);
if (row == NULL) return;

View File

@ -20,6 +20,7 @@
#include "guiengine/engine.hpp"
#include "input/input_manager.hpp"
#include "io/file_manager.hpp"
#include "states_screens/state_manager.hpp"
#include "utils/string_utils.hpp"
#include <cmath>
@ -279,8 +280,7 @@ EventPropagation RibbonWidget::rightPressed(const int playerID)
if (m_ribbon_type == RIBBON_COMBO)
{
const int mousePlayerID = input_manager->getPlayerKeyboardID();
const int MASTER_PLAYER = 0; // FIXME: unclean
if (playerID == mousePlayerID || playerID == MASTER_PLAYER)
if (playerID == mousePlayerID || playerID == PLAYER_ID_GAME_MASTER)
{
m_mouse_focus = m_children.get(m_selection[playerID]);
}
@ -320,8 +320,7 @@ EventPropagation RibbonWidget::leftPressed(const int playerID)
if (m_ribbon_type == RIBBON_COMBO)
{
const int mousePlayerID = input_manager->getPlayerKeyboardID();
const int MASTER_PLAYER = 0; // FIXME: unclean
if (playerID == mousePlayerID || playerID == MASTER_PLAYER)
if (playerID == mousePlayerID || playerID == PLAYER_ID_GAME_MASTER)
{
m_mouse_focus = m_children.get(m_selection[playerID]);
}
@ -353,8 +352,8 @@ EventPropagation RibbonWidget::focused(const int playerID)
if (m_ribbon_type == RIBBON_COMBO)
{
const int mousePlayerID = input_manager->getPlayerKeyboardID();
const int MASTER_PLAYER = 0; // FIXME: unclean
if (m_mouse_focus == NULL && m_selection[playerID] != -1 && (playerID == mousePlayerID || playerID == MASTER_PLAYER))
if (m_mouse_focus == NULL && m_selection[playerID] != -1 &&
(playerID == mousePlayerID || playerID == PLAYER_ID_GAME_MASTER))
{
m_mouse_focus = m_children.get(m_selection[playerID]);
}

View File

@ -264,7 +264,7 @@ void InputManager::inputSensing(Input::InputType type, int deviceID, int btnID,
int InputManager::getPlayerKeyboardID() const
{
// In no-assign mode, just return the GUI player ID (devices not assigned yet)
if (m_device_manager->getAssignMode() == NO_ASSIGN) return GUI_PLAYER_ID;
if (m_device_manager->getAssignMode() == NO_ASSIGN) return PLAYER_ID_GAME_MASTER;
// Otherwise, after devices are assigned, we can check in more depth
// Return the first keyboard that is actually being used

View File

@ -46,7 +46,7 @@ void ArenasScreen::eventCallback(Widget* widget, const std::string& name, const
DynamicRibbonWidget* w2 = dynamic_cast<DynamicRibbonWidget*>(widget);
if(w2==NULL) return;
const std::string selection = w2->getSelectionIDString(GUI_PLAYER_ID);
const std::string selection = w2->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if(UserConfigParams::m_verbosity>=5)
std::cout << "Clicked on arena " << selection.c_str() << std::endl;

View File

@ -112,9 +112,8 @@ void ChallengesScreen::eventCallback(GUIEngine::Widget* widget, const std::strin
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("challenges");
assert( w != NULL );
// FIXME : don't hardcode player 0?
const int playerID = 0;
std::string selection = w->getSelectionIDString( playerID );
// only player 0 can start a challenge (i.e. we have no multiplayer challenges)
std::string selection = w->getSelectionIDString( PLAYER_ID_GAME_MASTER );
if (selection == "locked")
{

View File

@ -82,7 +82,7 @@ AddDeviceDialog::AddDeviceDialog() : ModalDialog(0.7f, 0.7f)
m_children.push_back(widget);
widget->add();
widget->setFocusForPlayer( GUI_PLAYER_ID );
widget->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
}

View File

@ -88,7 +88,7 @@ ConfirmResolutionDialog::ConfirmResolutionDialog() : ModalDialog(0.7f, 0.7f)
m_children.push_back(widget);
widget->add();
widget->setFocusForPlayer( GUI_PLAYER_ID );
widget->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
}
}

View File

@ -65,7 +65,7 @@ EnterPlayerNameDialog::EnterPlayerNameDialog(const float w, const float h) :
textCtrl->setParent(m_irrlicht_window);
m_children.push_back(textCtrl);
textCtrl->add();
textCtrl->setFocusForPlayer(GUI_PLAYER_ID);
textCtrl->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
// TODO : add Ok button

View File

@ -158,7 +158,7 @@ GPInfoDialog::GPInfoDialog(const std::string& gpIdent, const float w, const floa
okBtn->getIrrlichtElement()->setTabStop(true);
okBtn->getIrrlichtElement()->setTabGroup(false);
okBtn->setFocusForPlayer( GUI_PLAYER_ID );
okBtn->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
}

View File

@ -115,7 +115,7 @@ void PlayerInfoDialog::showRegularDialog()
widget->add();
}
textCtrl->setFocusForPlayer( GUI_PLAYER_ID );
textCtrl->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
}
// ------------------------------------------------------------------------------------------------------
@ -178,7 +178,7 @@ void PlayerInfoDialog::showConfirmDialog()
m_children.push_back(widget);
widget->add();
widget->setFocusForPlayer( GUI_PLAYER_ID );
widget->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
}
}

View File

@ -270,7 +270,7 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
m_children.push_back(whats_next_btn);
whats_next_btn->add();
whats_next_btn->setFocusForPlayer( GUI_PLAYER_ID );
whats_next_btn->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
}
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_SINGLE)
{
@ -309,7 +309,7 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
m_children.push_back(whats_next_btn);
whats_next_btn->add();
whats_next_btn->setFocusForPlayer( GUI_PLAYER_ID );
whats_next_btn->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
}
else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX)
{
@ -326,7 +326,7 @@ RaceOverDialog::RaceOverDialog(const float percentWidth,
m_children.push_back(whats_next_btn);
whats_next_btn->add();
whats_next_btn->setFocusForPlayer( GUI_PLAYER_ID );
whats_next_btn->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
ButtonWidget* abort_gp = new ButtonWidget();

View File

@ -76,7 +76,7 @@ RacePausedDialog::RacePausedDialog(const float percentWidth, const float percent
m_children.push_back(back_btn);
back_btn->add();
back_btn->setFocusForPlayer( GUI_PLAYER_ID );
back_btn->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
// ---- Choice ribbon
m_choice_ribbon = new RibbonWidget(RIBBON_TOOLBAR);
@ -167,7 +167,7 @@ GUIEngine::EventPropagation RacePausedDialog::processEvent(const std::string& ev
}
else if (eventSource == "choiceribbon")
{
const std::string& selection = m_choice_ribbon->getSelectionIDString(GUI_PLAYER_ID);
const std::string& selection = m_choice_ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if(UserConfigParams::m_verbosity>=5)
std::cout << "RacePausedDialog::processEvent("

View File

@ -153,7 +153,7 @@ TrackInfoDialog::TrackInfoDialog(const std::string& trackIdent, const irr::core:
okBtn->getIrrlichtElement()->setTabStop(true);
okBtn->getIrrlichtElement()->setTabGroup(false);
okBtn->setFocusForPlayer( GUI_PLAYER_ID );
okBtn->setFocusForPlayer( PLAYER_ID_GAME_MASTER );
}

View File

@ -38,7 +38,7 @@ void HelpScreen1::eventCallback(Widget* widget, const std::string& name, const i
{
if (name == "category")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(GUI_PLAYER_ID).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
//if (selection == "page1") StateManager::get()->replaceTopMostScreen(Help1Screen::getInstance());
//else
@ -57,7 +57,7 @@ void HelpScreen1::init()
{
RibbonWidget* w = this->getWidget<RibbonWidget>("category");
if (w != NULL) w->select( "page1", GUI_PLAYER_ID );
if (w != NULL) w->select( "page1", PLAYER_ID_GAME_MASTER );
}
// ------------------------------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ void HelpScreen2::eventCallback(Widget* widget, const std::string& name, const i
{
if (name == "category")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(GUI_PLAYER_ID).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
if(selection == "page1") StateManager::get()->replaceTopMostScreen(HelpScreen1::getInstance());
//else if(selection == "page2") StateManager::get()->replaceTopMostScreen(HelpScreen2::getInstance());
@ -56,7 +56,7 @@ void HelpScreen2::init()
{
RibbonWidget* w = this->getWidget<RibbonWidget>("category");
if (w != NULL) w->select( "page2", GUI_PLAYER_ID );
if (w != NULL) w->select( "page2", PLAYER_ID_GAME_MASTER );
}
// ------------------------------------------------------------------------------------------------------

View File

@ -38,7 +38,7 @@ void HelpScreen3::eventCallback(Widget* widget, const std::string& name, const i
{
if (name == "category")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(GUI_PLAYER_ID).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
if (selection == "page1") StateManager::get()->replaceTopMostScreen(HelpScreen1::getInstance());
else if (selection == "page2") StateManager::get()->replaceTopMostScreen(HelpScreen2::getInstance());
@ -56,7 +56,7 @@ void HelpScreen3::init()
{
RibbonWidget* w = this->getWidget<RibbonWidget>("category");
if (w != NULL) w->select( "page3", GUI_PLAYER_ID );
if (w != NULL) w->select( "page3", PLAYER_ID_GAME_MASTER );
}
// ------------------------------------------------------------------------------------------------------

View File

@ -1032,7 +1032,7 @@ void KartSelectionScreen::eventCallback(Widget* widget, const std::string& name,
setKartsFromCurrentGroup();
const std::string selected_kart_group = tabs->getSelectionIDString(GUI_PLAYER_ID);
const std::string selected_kart_group = tabs->getSelectionIDString(PLAYER_ID_GAME_MASTER);
// update players selections (FIXME: don't hardcode player 0 below)
const int num_players = m_kart_widgets.size();
@ -1386,7 +1386,7 @@ void KartSelectionScreen::setKartsFromCurrentGroup()
RibbonWidget* tabs = this->getWidget<RibbonWidget>("kartgroups");
assert(tabs != NULL);
const std::string selected_kart_group = tabs->getSelectionIDString(GUI_PLAYER_ID);
const std::string selected_kart_group = tabs->getSelectionIDString(PLAYER_ID_GAME_MASTER);
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("karts");
w->clearItems();

View File

@ -69,7 +69,7 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, cons
{
RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget);
if (ribbon == NULL) return; // only interesting stuff in main menu is the ribbons
std::string selection = ribbon->getSelectionIDString(GUI_PLAYER_ID);
std::string selection = ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "network")

View File

@ -46,7 +46,7 @@ OptionsScreenAV::OptionsScreenAV() : Screen("options_av.stkgui")
void OptionsScreenAV::init()
{
RibbonWidget* ribbon = this->getWidget<RibbonWidget>("options_choice");
if (ribbon != NULL) ribbon->select( "tab_audio_video", GUI_PLAYER_ID );
if (ribbon != NULL) ribbon->select( "tab_audio_video", PLAYER_ID_GAME_MASTER );
// ---- sfx volume
SpinnerWidget* gauge = this->getWidget<SpinnerWidget>("sfx_volume");
@ -128,7 +128,7 @@ void OptionsScreenAV::init()
{
//std::cout << "************* Detected right resolution!!! " << n << "\n";
// that's the current one
res->setSelection(n, GUI_PLAYER_ID, false);
res->setSelection(n, PLAYER_ID_GAME_MASTER, false);
break;
}
} // end for
@ -142,7 +142,7 @@ void OptionsScreenAV::eventCallback(Widget* widget, const std::string& name, con
{
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(GUI_PLAYER_ID).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
if (selection == "tab_audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
@ -206,7 +206,7 @@ void OptionsScreenAV::eventCallback(Widget* widget, const std::string& name, con
DynamicRibbonWidget* w1 = this->getWidget<DynamicRibbonWidget>("resolutions");
assert(w1 != NULL);
const std::string& res = w1->getSelectionIDString(GUI_PLAYER_ID);
const std::string& res = w1->getSelectionIDString(PLAYER_ID_GAME_MASTER);
int w = -1, h = -1;
if (sscanf(res.c_str(), "%ix%i", &w, &h) != 2 || w == -1 || h == -1)

View File

@ -263,7 +263,7 @@ void OptionsScreenInput::buildDeviceList()
void OptionsScreenInput::init()
{
RibbonWidget* tabBar = this->getWidget<RibbonWidget>("options_choice");
if (tabBar != NULL) tabBar->select( "tab_controls", GUI_PLAYER_ID );
if (tabBar != NULL) tabBar->select( "tab_controls", PLAYER_ID_GAME_MASTER );
DynamicRibbonWidget* devices = this->getWidget<DynamicRibbonWidget>("devices");
@ -278,7 +278,7 @@ void OptionsScreenInput::init()
// trigger displaying bindings for default selected device
const std::string name2("devices");
eventCallback(devices, name2, GUI_PLAYER_ID);
eventCallback(devices, name2, PLAYER_ID_GAME_MASTER);
}
// -----------------------------------------------------------------------------
@ -303,7 +303,7 @@ void OptionsScreenInput::gotSensedInput(Input* sensedInput)
DynamicRibbonWidget* devices = this->getWidget<DynamicRibbonWidget>("devices");
assert( devices != NULL );
std::string deviceID = devices->getSelectionIDString(GUI_PLAYER_ID);
std::string deviceID = devices->getSelectionIDString(PLAYER_ID_GAME_MASTER);
const bool keyboard = sensedInput->type == Input::IT_KEYBOARD && deviceID.find("keyboard") != std::string::npos;
const bool gamepad = (sensedInput->type == Input::IT_STICKMOTION ||
@ -327,7 +327,7 @@ void OptionsScreenInput::gotSensedInput(Input* sensedInput)
// extract keyboard ID from name
int configID = -1;
sscanf( devices->getSelectionIDString(GUI_PLAYER_ID).c_str(), "keyboard%i", &configID );
sscanf( devices->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str(), "keyboard%i", &configID );
KeyboardConfig* keyboard = input_manager->getDeviceList()->getKeyboardConfig(configID);
keyboard->setBinding(binding_to_set, Input::IT_KEYBOARD, sensedInput->btnID, Input::AD_NEUTRAL);
@ -354,7 +354,7 @@ void OptionsScreenInput::gotSensedInput(Input* sensedInput)
// extract gamepad ID from name
int configID = -1;
sscanf( devices->getSelectionIDString(GUI_PLAYER_ID).c_str(), "gamepad%i", &configID );
sscanf( devices->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str(), "gamepad%i", &configID );
GamepadConfig* config = input_manager->getDeviceList()->getGamepadConfig(configID);
config->setBinding(binding_to_set, sensedInput->type, sensedInput->btnID,
@ -373,7 +373,7 @@ void OptionsScreenInput::gotSensedInput(Input* sensedInput)
// re-select the previous button
ButtonWidget* btn = this->getWidget<ButtonWidget>(binding_to_set_button.c_str());
if(btn != NULL) btn->setFocusForPlayer(GUI_PLAYER_ID);
if(btn != NULL) btn->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
// save new binding to file
input_manager->getDeviceList()->serialize();
@ -391,7 +391,7 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(GUI_PLAYER_ID).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
if (selection == "tab_audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
@ -410,7 +410,7 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
DynamicRibbonWidget* devices = this->getWidget<DynamicRibbonWidget>("devices");
assert(devices != NULL);
const std::string& selection = devices->getSelectionIDString(GUI_PLAYER_ID);
const std::string& selection = devices->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection.find("gamepad") != std::string::npos)
{
int i = -1, read = 0;
@ -490,11 +490,11 @@ void OptionsScreenInput::eventCallback(Widget* widget, const std::string& name,
DynamicRibbonWidget* devices = this->getWidget<DynamicRibbonWidget>("devices");
assert( devices != NULL );
std::cout << "\n% Entering sensing mode for " << devices->getSelectionIDString(GUI_PLAYER_ID).c_str() << std::endl;
std::cout << "\n% Entering sensing mode for " << devices->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str() << std::endl;
new PressAKeyDialog(0.4f, 0.4f);
std::string selection = devices->getSelectionIDString(GUI_PLAYER_ID);
std::string selection = devices->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection.find("keyboard") != std::string::npos)
{
input_manager->setMode(InputManager::INPUT_SENSE_KEYBOARD);

View File

@ -50,7 +50,7 @@ OptionsScreenPlayers::OptionsScreenPlayers() : Screen("options_players.stkgui")
void OptionsScreenPlayers::init()
{
RibbonWidget* tabBar = this->getWidget<RibbonWidget>("options_choice");
if (tabBar != NULL) tabBar->select( "tab_players", GUI_PLAYER_ID );
if (tabBar != NULL) tabBar->select( "tab_players", PLAYER_ID_GAME_MASTER );
ListWidget* players = this->getWidget<ListWidget>("players");
assert(players != NULL);
@ -133,7 +133,7 @@ void OptionsScreenPlayers::eventCallback(Widget* widget, const std::string& name
{
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(GUI_PLAYER_ID).c_str();
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
if (selection == "tab_audio_video") StateManager::get()->replaceTopMostScreen(OptionsScreenAV::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());

View File

@ -64,7 +64,7 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, con
{
RibbonWidget* w = dynamic_cast<RibbonWidget*>(widget);
assert(w != NULL);
const std::string& selection = w->getSelectionIDString(GUI_PLAYER_ID);
const std::string& selection = w->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "novice")
{
@ -85,7 +85,7 @@ void RaceSetupScreen::eventCallback(Widget* widget, const std::string& name, con
else if (name == "gamemode")
{
DynamicRibbonWidget* w = dynamic_cast<DynamicRibbonWidget*>(widget);
const std::string selectedMode = w->getSelectionIDString(GUI_PLAYER_ID);
const std::string selectedMode = w->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selectedMode == "normal")
{
@ -155,7 +155,7 @@ void RaceSetupScreen::init()
{
RibbonWidget* w = getWidget<RibbonWidget>("difficulty");
assert( w != NULL );
w->setSelection( race_manager->getDifficulty(), GUI_PLAYER_ID );
w->setSelection( race_manager->getDifficulty(), PLAYER_ID_GAME_MASTER );
SpinnerWidget* kartamount = getWidget<SpinnerWidget>("aikartamount");
kartamount->setValue( race_manager->getNumberOfKarts() - race_manager->getNumPlayers() );

View File

@ -33,7 +33,7 @@ namespace GUIEngine
class Widget;
}
const static int GUI_PLAYER_ID = 0;
const static int PLAYER_ID_GAME_MASTER = 0;
class StateManager : public GUIEngine::AbstractStateManager
{

View File

@ -78,7 +78,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const
DynamicRibbonWidget* w2 = dynamic_cast<DynamicRibbonWidget*>(widget);
if (w2 != NULL)
{
const std::string selection = w2->getSelectionIDString(GUI_PLAYER_ID);
const std::string selection = w2->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if(UserConfigParams::m_verbosity>=5)
std::cout << "Clicked on track " << selection.c_str()
<< std::endl;
@ -128,7 +128,7 @@ void TracksScreen::eventCallback(Widget* widget, const std::string& name, const
DynamicRibbonWidget* gps_widget = dynamic_cast<DynamicRibbonWidget*>(widget);
if (gps_widget != NULL)
{
std::string selection = gps_widget->getSelectionIDString(GUI_PLAYER_ID);
std::string selection = gps_widget->getSelectionIDString(PLAYER_ID_GAME_MASTER);
if (selection == "locked")
{
@ -211,8 +211,8 @@ void TracksScreen::init()
buildTrackList();
// FIXME: don't hardcode player 0?
tracks_widget->setSelection(tracks_widget->getItems()[0].m_code_name, 0, true);
// select something for the game master
tracks_widget->setSelection(tracks_widget->getItems()[0].m_code_name, PLAYER_ID_GAME_MASTER, true);
}
// -----------------------------------------------------------------------------------------------
@ -262,7 +262,6 @@ void TracksScreen::buildTrackList()
}
else
{
//FIXME: don't hardcode player 0?
const std::vector<int>& curr_group = track_manager->getTracksInGroup( curr_group_name );
const int trackAmount = curr_group.size();
@ -280,13 +279,13 @@ void TracksScreen::buildTrackList()
else
{
tracks_widget->addItem( curr->getName(), curr->getIdent(), curr->getScreenshotFile(),
0, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE );
0 /* no badge */, IconButtonWidget::ICON_PATH_TYPE_ABSOLUTE );
}
}
}
tracks_widget->addItem(_("Random Track"), "random_track", "/gui/track_random.png",
0, IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
0 /* no badge */, IconButtonWidget::ICON_PATH_TYPE_RELATIVE);
tracks_widget->updateItemDisplay();
}
@ -298,8 +297,8 @@ void TracksScreen::setFocusOnTrack(const std::string& trackName)
DynamicRibbonWidget* tracks_widget = this->getWidget<DynamicRibbonWidget>("tracks");
assert( tracks_widget != NULL );
// FIXME: don't hardcode player 0?
tracks_widget->setSelection(trackName, 0, true);
// only the game master can select tracks, so it's safe to use 'PLAYER_ID_GAME_MASTER'
tracks_widget->setSelection(trackName, PLAYER_ID_GAME_MASTER, true);
}
// -----------------------------------------------------------------------------------------------
@ -309,8 +308,8 @@ void TracksScreen::setFocusOnGP(const std::string& gpName)
DynamicRibbonWidget* gps_widget = this->getWidget<DynamicRibbonWidget>("gps");
assert( gps_widget != NULL );
// FIXME: don't hardcode player 0?
gps_widget->setSelection(gpName, 0, true);
// only the game master can select tracks/GPs, so it's safe to use 'PLAYER_ID_GAME_MASTER'
gps_widget->setSelection(gpName, PLAYER_ID_GAME_MASTER, true);
}
// -----------------------------------------------------------------------------------------------