Fixed crash if more than one kart is connected to the server (since the
network kart screen will only show local karts now).
This commit is contained in:
parent
e0b3de17f6
commit
770d05f0de
@ -817,7 +817,8 @@ void KartSelectionScreen::updateKartStats(uint8_t widget_id,
|
||||
}
|
||||
}
|
||||
|
||||
void KartSelectionScreen::updateKartWidgetModel(uint8_t widget_id,
|
||||
// ----------------------------------------------------------------------------
|
||||
void KartSelectionScreen::updateKartWidgetModel(int widget_id,
|
||||
const std::string& selection,
|
||||
const irr::core::stringw& selectionText)
|
||||
{
|
||||
|
@ -107,8 +107,9 @@ protected:
|
||||
void updateKartStats(uint8_t widget_id,
|
||||
const std::string& selection);
|
||||
|
||||
/** updates model of a kart widget, to have the good selection when the user validates */
|
||||
void updateKartWidgetModel(uint8_t widget_id,
|
||||
/** updates model of a kart widget, to have the good selection when the
|
||||
* user validates */
|
||||
void updateKartWidgetModel(int widget_id,
|
||||
const std::string& selection,
|
||||
const irr::core::stringw& selectionText);
|
||||
|
||||
|
@ -144,7 +144,7 @@ void NetworkKartSelectionScreen::playerConfirm(const int playerID)
|
||||
void NetworkKartSelectionScreen::playerSelected(uint8_t player_id,
|
||||
const std::string &kart_name)
|
||||
{
|
||||
uint8_t widget_id = -1;
|
||||
int widget_id = -1;
|
||||
for (unsigned int i = 0; i < m_id_mapping.size(); i++)
|
||||
{
|
||||
Log::info("NKSS", "Checking race id %d : mapped of %d is %d",
|
||||
@ -153,7 +153,10 @@ void NetworkKartSelectionScreen::playerSelected(uint8_t player_id,
|
||||
widget_id = i;
|
||||
}
|
||||
|
||||
assert(widget_id>=0 && widget_id < m_kart_widgets.size());
|
||||
// This selection was for a remote kart, which is not shown
|
||||
// Just ignore it.
|
||||
if(widget_id==-1)
|
||||
return;
|
||||
|
||||
KartSelectionScreen::updateKartWidgetModel(widget_id, kart_name,
|
||||
irr::core::stringw(kart_name.c_str()));
|
||||
|
@ -33,11 +33,11 @@ protected:
|
||||
virtual ~NetworkKartSelectionScreen();
|
||||
|
||||
virtual void playerConfirm(const int playerID);
|
||||
void considerKartHovered(uint8_t widget_id, std::string selection);
|
||||
public:
|
||||
virtual void init() OVERRIDE;
|
||||
virtual bool onEscapePressed() OVERRIDE;
|
||||
virtual void playerSelected(uint8_t race_id, const std::string &kart_name);
|
||||
virtual void playerSelected(uint8_t player_id,
|
||||
const std::string &kart_name);
|
||||
};
|
||||
|
||||
#endif // NETWORK_KART_SELECTION_HPP
|
||||
|
Loading…
x
Reference in New Issue
Block a user