Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix world selection a bit (also fixes a main menu segfault)
  • Loading branch information
kahrl authored and PilzAdam committed May 8, 2013
1 parent 0913287 commit f00cee7
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/guiMainMenu.cpp
Expand Up @@ -726,9 +726,11 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
gui::IGUIListBox *e = Environment->addListBox(rect, this,
GUI_ID_WORLD_LISTBOX);
e->setDrawBackground(true);
for(std::vector<WorldSpec>::const_iterator i = m_data->worlds.begin();
i != m_data->worlds.end(); i++){
e->addItem(narrow_to_wide(i->name+" ["+i->gameid+"]").c_str());
m_world_indices.clear();
for(size_t wi = 0; wi < m_data->worlds.size(); wi++){
const WorldSpec &spec = m_data->worlds[wi];
e->addItem(narrow_to_wide(spec.name+" ["+spec.gameid+"]").c_str());
m_world_indices.push_back(wi);
}
e->setSelected(m_data->selected_world);
}
Expand Down Expand Up @@ -1380,6 +1382,10 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
return true;
}
}
if(event.GUIEvent.EventType==gui::EGET_LISTBOX_CHANGED)
{
readInput(m_data);
}
if(event.GUIEvent.EventType==gui::EGET_LISTBOX_SELECTED_AGAIN)
{
switch(event.GUIEvent.Caller->getID())
Expand Down

0 comments on commit f00cee7

Please sign in to comment.