diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-03-13 00:58:57 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-03-13 00:58:57 +0200 |
commit | 800d3b4ee7dfe527d8540c9e2464117dc24ad1d0 (patch) | |
tree | 5cc42325c87294f4631b71ccd1c20fc91d947682 /src/guiCreateWorld.cpp | |
parent | a0b2c7ba25874d59980c03bc74359a05e32c4822 (diff) | |
download | minetest-800d3b4ee7dfe527d8540c9e2464117dc24ad1d0.tar.gz minetest-800d3b4ee7dfe527d8540c9e2464117dc24ad1d0.tar.bz2 minetest-800d3b4ee7dfe527d8540c9e2464117dc24ad1d0.zip |
Fix game selection in world creation (used always the first one)
Diffstat (limited to 'src/guiCreateWorld.cpp')
-rw-r--r-- | src/guiCreateWorld.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/guiCreateWorld.cpp b/src/guiCreateWorld.cpp index 7143f9558..159e736c3 100644 --- a/src/guiCreateWorld.cpp +++ b/src/guiCreateWorld.cpp @@ -184,11 +184,20 @@ void GUICreateWorld::acceptInput() { if(m_dest) { - gui::IGUIElement *e = getElementFromId(GUI_ID_NAME_INPUT); - if(e != NULL) + int selected = -1; + { + gui::IGUIElement *e = getElementFromId(GUI_ID_GAME_LISTBOX); + if(e != NULL && e->getType() == gui::EGUIET_LIST_BOX) + selected = ((gui::IGUIListBox*)e)->getSelected(); + } + std::wstring name; { - m_dest->accepted(e->getText(), m_games[0].id); + gui::IGUIElement *e = getElementFromId(GUI_ID_NAME_INPUT); + if(e != NULL) + name = e->getText(); } + if(selected != -1 && name != L"") + m_dest->accepted(name, m_games[selected].id); delete m_dest; m_dest = NULL; } |