*/
readInput(m_data);
- int active_tab = getTab();
-
/*
Remove stuff
*/
changeCtype("");
// Version
- if(active_tab != TAB_CREDITS)
+ if(m_data->selected_tab != TAB_CREDITS)
{
core::rect<s32> rect(0, 0, size.X, 40);
rect += v2s32(4, 0);
m_topleft_server = c800 + v2s32(90, 70+30+50+290);
m_size_server = v2s32(620, 140);
- if(active_tab == TAB_ADVANCED)
+ if(m_data->selected_tab == TAB_ADVANCED)
{
m_topleft_client = c800 + v2s32(90, 20+50+30);
m_size_client = v2s32(620, 270);
e->addTab(L"Multiplayer");
e->addTab(L"Advanced");
e->addTab(L"Credits");
- e->setActiveTab(active_tab);
+ e->setActiveTab(m_data->selected_tab);
}
#endif
- if(active_tab == TAB_SINGLEPLAYER)
+ if(m_data->selected_tab == TAB_SINGLEPLAYER)
{
// HYBRID
{
e->addItem(narrow_to_wide(i->name+" ["+i->gameid+"]").c_str());
}
e->setSelected(m_data->selected_world);
+ Environment->setFocus(e);
}
// Delete world button
{
}
changeCtype("C");
}
- else if(active_tab == TAB_MULTIPLAYER)
+ else if(m_data->selected_tab == TAB_MULTIPLAYER)
{
changeCtype("");
// CLIENT
}
changeCtype("C");
}
- else if(active_tab == TAB_ADVANCED)
+ else if(m_data->selected_tab == TAB_ADVANCED)
{
changeCtype("");
// CLIENT
}
changeCtype("C");
}
- else if(active_tab == TAB_CREDITS)
+ else if(m_data->selected_tab == TAB_CREDITS)
{
// CREDITS
{
void GUIMainMenu::readInput(MainMenuData *dst)
{
+ {
+ gui::IGUIElement *e = getElementFromId(GUI_ID_TAB_CONTROL);
+ if(e != NULL && e->getType() == gui::EGUIET_TAB_CONTROL)
+ dst->selected_tab = ((gui::IGUITabControl*)e)->getActiveTab();
+ }
if(getTab() == TAB_SINGLEPLAYER)
{
dst->name = L"singleplayer";
gui::IGUIElement *e = getElementFromId(GUI_ID_TAB_CONTROL);
if(e != NULL && e->getType() == gui::EGUIET_TAB_CONTROL)
return ((gui::IGUITabControl*)e)->getActiveTab();
- //return TAB_ADVANCED; // Default
return TAB_SINGLEPLAYER; // Default
}
// Initialize menu data
MainMenuData menudata;
+ if(g_settings->exists("selected_mainmenu_tab"))
+ menudata.selected_tab = g_settings->getS32("selected_mainmenu_tab");
menudata.address = narrow_to_wide(address);
menudata.name = narrow_to_wide(playername);
menudata.port = narrow_to_wide(itos(port));
sleep_ms(25);
}
- // Break out of menu-game loop to shut down cleanly
- if(device->run() == false || kill == true)
- break;
-
infostream<<"Dropping main menu"<<std::endl;
menu->drop();
}
+ playername = wide_to_narrow(menudata.name);
+ password = translatePassword(playername, menudata.password);
+ //infostream<<"Main: password hash: '"<<password<<"'"<<std::endl;
+
+ address = wide_to_narrow(menudata.address);
+ int newport = stoi(wide_to_narrow(menudata.port));
+ if(newport != 0)
+ port = newport;
+ // Save settings
+ g_settings->setS32("selected_mainmenu_tab", menudata.selected_tab);
+ g_settings->set("new_style_leaves", itos(menudata.fancy_trees));
+ g_settings->set("smooth_lighting", itos(menudata.smooth_lighting));
+ g_settings->set("enable_3d_clouds", itos(menudata.clouds_3d));
+ g_settings->set("opaque_water", itos(menudata.opaque_water));
+ g_settings->set("creative_mode", itos(menudata.creative_mode));
+ g_settings->set("enable_damage", itos(menudata.enable_damage));
+ g_settings->set("name", playername);
+ g_settings->set("address", address);
+ g_settings->set("port", itos(port));
+ if(menudata.selected_world != -1)
+ g_settings->set("selected_world_path",
+ worldspecs[menudata.selected_world].path);
+ /*// Update configuration file
+ if(configpath != "")
+ g_settings->updateConfigFile(configpath.c_str());*/
+
+ // Break out of menu-game loop to shut down cleanly
+ if(device->run() == false || kill == true)
+ break;
+
// Set world path to selected one
if(menudata.selected_world != -1){
worldspec = worldspecs[menudata.selected_world];
continue;
}
- playername = wide_to_narrow(menudata.name);
- password = translatePassword(playername, menudata.password);
- //infostream<<"Main: password hash: '"<<password<<"'"<<std::endl;
-
- address = wide_to_narrow(menudata.address);
- int newport = stoi(wide_to_narrow(menudata.port));
- if(newport != 0)
- port = newport;
- // Save settings
- g_settings->set("new_style_leaves", itos(menudata.fancy_trees));
- g_settings->set("smooth_lighting", itos(menudata.smooth_lighting));
- g_settings->set("enable_3d_clouds", itos(menudata.clouds_3d));
- g_settings->set("opaque_water", itos(menudata.opaque_water));
- g_settings->set("creative_mode", itos(menudata.creative_mode));
- g_settings->set("enable_damage", itos(menudata.enable_damage));
- g_settings->set("name", playername);
- g_settings->set("address", address);
- g_settings->set("port", itos(port));
- if(menudata.selected_world != -1)
- g_settings->set("selected_world_path",
- worldspecs[menudata.selected_world].path);
- // Update configuration file
- if(configpath != "")
- g_settings->updateConfigFile(configpath.c_str());
-
// If local game
if(address == "")
{