forked from Mirrorlandia_minetest/minetest
Pre-select current game in world creation dialog
This commit is contained in:
parent
80874391b8
commit
2cf76f6f1b
@ -42,13 +42,22 @@ GUICreateWorld::GUICreateWorld(gui::IGUIEnvironment* env,
|
|||||||
gui::IGUIElement* parent, s32 id,
|
gui::IGUIElement* parent, s32 id,
|
||||||
IMenuManager *menumgr,
|
IMenuManager *menumgr,
|
||||||
CreateWorldDest *dest,
|
CreateWorldDest *dest,
|
||||||
const std::vector<SubgameSpec> &games
|
const std::vector<SubgameSpec> &games,
|
||||||
|
const std::string &initial_game
|
||||||
):
|
):
|
||||||
GUIModalMenu(env, parent, id, menumgr),
|
GUIModalMenu(env, parent, id, menumgr),
|
||||||
m_dest(dest),
|
m_dest(dest),
|
||||||
m_games(games)
|
m_games(games),
|
||||||
|
m_initial_game_i(0)
|
||||||
{
|
{
|
||||||
assert(games.size() > 0);
|
assert(games.size() > 0);
|
||||||
|
|
||||||
|
for(size_t i=0; i<games.size(); i++){
|
||||||
|
if(games[i].id == initial_game){
|
||||||
|
m_initial_game_i = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GUICreateWorld::~GUICreateWorld()
|
GUICreateWorld::~GUICreateWorld()
|
||||||
@ -151,7 +160,7 @@ void GUICreateWorld::regenerateGui(v2u32 screensize)
|
|||||||
os<<L"]";
|
os<<L"]";
|
||||||
e->addItem(os.str().c_str());
|
e->addItem(os.str().c_str());
|
||||||
}
|
}
|
||||||
e->setSelected(0);
|
e->setSelected(m_initial_game_i);
|
||||||
}
|
}
|
||||||
changeCtype("");
|
changeCtype("");
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,8 @@ public:
|
|||||||
gui::IGUIElement* parent, s32 id,
|
gui::IGUIElement* parent, s32 id,
|
||||||
IMenuManager *menumgr,
|
IMenuManager *menumgr,
|
||||||
CreateWorldDest *dest,
|
CreateWorldDest *dest,
|
||||||
const std::vector<SubgameSpec> &games);
|
const std::vector<SubgameSpec> &games,
|
||||||
|
const std::string &initial_game);
|
||||||
~GUICreateWorld();
|
~GUICreateWorld();
|
||||||
|
|
||||||
void removeChildren();
|
void removeChildren();
|
||||||
@ -56,6 +57,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
CreateWorldDest *m_dest;
|
CreateWorldDest *m_dest;
|
||||||
std::vector<SubgameSpec> m_games;
|
std::vector<SubgameSpec> m_games;
|
||||||
|
int m_initial_game_i;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1274,7 +1274,7 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
|
|||||||
} else {
|
} else {
|
||||||
CreateWorldDest *dest = new CreateWorldDestMainMenu(this);
|
CreateWorldDest *dest = new CreateWorldDestMainMenu(this);
|
||||||
GUICreateWorld *menu = new GUICreateWorld(env, parent, -1,
|
GUICreateWorld *menu = new GUICreateWorld(env, parent, -1,
|
||||||
menumgr, dest, games);
|
menumgr, dest, games, m_data->selected_game);
|
||||||
menu->drop();
|
menu->drop();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user