1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-11-15 22:05:07 -05:00

Fix game selection in world creation (used always the first one)

This commit is contained in:
Perttu Ahola 2012-03-13 00:58:57 +02:00
parent a0b2c7ba25
commit 800d3b4ee7

View File

@ -183,12 +183,21 @@ void GUICreateWorld::drawMenu()
void GUICreateWorld::acceptInput()
{
if(m_dest)
{
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;
{
gui::IGUIElement *e = getElementFromId(GUI_ID_NAME_INPUT);
if(e != NULL)
{
m_dest->accepted(e->getText(), m_games[0].id);
name = e->getText();
}
if(selected != -1 && name != L"")
m_dest->accepted(name, m_games[selected].id);
delete m_dest;
m_dest = NULL;
}