Skip to content

Commit f00cee7

Browse files
kahrlPilzAdam
authored andcommittedMay 8, 2013
Fix world selection a bit (also fixes a main menu segfault)
1 parent 0913287 commit f00cee7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed
 

‎src/guiMainMenu.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,11 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
726726
gui::IGUIListBox *e = Environment->addListBox(rect, this,
727727
GUI_ID_WORLD_LISTBOX);
728728
e->setDrawBackground(true);
729-
for(std::vector<WorldSpec>::const_iterator i = m_data->worlds.begin();
730-
i != m_data->worlds.end(); i++){
731-
e->addItem(narrow_to_wide(i->name+" ["+i->gameid+"]").c_str());
729+
m_world_indices.clear();
730+
for(size_t wi = 0; wi < m_data->worlds.size(); wi++){
731+
const WorldSpec &spec = m_data->worlds[wi];
732+
e->addItem(narrow_to_wide(spec.name+" ["+spec.gameid+"]").c_str());
733+
m_world_indices.push_back(wi);
732734
}
733735
e->setSelected(m_data->selected_world);
734736
}
@@ -1380,6 +1382,10 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
13801382
return true;
13811383
}
13821384
}
1385+
if(event.GUIEvent.EventType==gui::EGET_LISTBOX_CHANGED)
1386+
{
1387+
readInput(m_data);
1388+
}
13831389
if(event.GUIEvent.EventType==gui::EGET_LISTBOX_SELECTED_AGAIN)
13841390
{
13851391
switch(event.GUIEvent.Caller->getID())

0 commit comments

Comments
 (0)
Please sign in to comment.