diff options
author | Kahrl <kahrl@gmx.net> | 2013-05-08 11:06:47 +0200 |
---|---|---|
committer | PilzAdam <pilzadam@minetest.net> | 2013-05-08 20:54:03 +0200 |
commit | f00cee75c153deceb0253b531228eec27d1e819b (patch) | |
tree | 41eaa5db209563fbb4b7f8a99975b8093f6eb277 /src | |
parent | 0913287578504f89489df6e0573c28c7ac428805 (diff) | |
download | minetest-f00cee75c153deceb0253b531228eec27d1e819b.tar.gz minetest-f00cee75c153deceb0253b531228eec27d1e819b.tar.bz2 minetest-f00cee75c153deceb0253b531228eec27d1e819b.zip |
Fix world selection a bit (also fixes a main menu segfault)
Diffstat (limited to 'src')
-rw-r--r-- | src/guiMainMenu.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/guiMainMenu.cpp b/src/guiMainMenu.cpp index 5d5ae1e90..48e41bb81 100644 --- a/src/guiMainMenu.cpp +++ b/src/guiMainMenu.cpp @@ -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); } @@ -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()) |