Random guest name and finite liquid checkbox 563/head
authorproller <proller@github.com>
Sat, 23 Mar 2013 13:37:50 +0000 (17:37 +0400)
committerproller <proller@github.com>
Sat, 23 Mar 2013 15:17:08 +0000 (19:17 +0400)
src/guiMainMenu.cpp
src/guiMainMenu.h
src/main.cpp

index 79170d99a5c34504a0b4eedc05320c676e5f3b00..9e6b01dd6f55570be67e4a369d0ea905a553f353 100644 (file)
@@ -140,6 +140,7 @@ enum
        GUI_ID_SHADERS_CB,
        GUI_ID_PRELOAD_ITEM_VISUALS_CB,
        GUI_ID_ENABLE_PARTICLES_CB,
+       GUI_ID_LIQUID_FINITE_CB,
        GUI_ID_DAMAGE_CB,
        GUI_ID_CREATIVE_CB,
        GUI_ID_PUBLIC_CB,
@@ -430,6 +431,10 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
                        e->setDrawBackground(true);
                        if (m_data->serverlist_show_available == false)
                                m_data->servers = ServerList::getLocal();
+#if USE_CURL
+                       else
+                               m_data->servers = ServerList::getOnline();
+#endif
                        updateGuiServerList();
                        e->setSelected(0);
                }
@@ -722,6 +727,13 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
                                        GUI_ID_ENABLE_PARTICLES_CB, wgettext("Enable Particles"));
                }
 
+               {
+                       core::rect<s32> rect(0, 0, option_w+20+20, 30);
+                       rect += m_topleft_client + v2s32(option_x+175*2, option_y+20*3);
+                       Environment->addCheckBox(m_data->liquid_finite, rect, this,
+                                       GUI_ID_LIQUID_FINITE_CB, wgettext("Finite liquid"));
+               }
+
                // Key change button
                {
                        core::rect<s32> rect(0, 0, 120, 30);
@@ -968,6 +980,12 @@ void GUIMainMenu::readInput(MainMenuData *dst)
                        dst->enable_particles = ((gui::IGUICheckBox*)e)->isChecked();
        }
 
+       {
+               gui::IGUIElement *e = getElementFromId(GUI_ID_LIQUID_FINITE_CB);
+               if(e != NULL && e->getType() == gui::EGUIET_CHECK_BOX)
+                       dst->liquid_finite = ((gui::IGUICheckBox*)e)->isChecked();
+       }
+
        {
                gui::IGUIElement *e = getElementFromId(GUI_ID_WORLD_LISTBOX);
                if(e != NULL && e->getType() == gui::EGUIET_LIST_BOX)
index a21f3b32acb4801f24e51790859b8b8bd726fb11..fa5f19defa1b31fdc729db00cf6912a6f4abe2fb 100644 (file)
@@ -52,6 +52,7 @@ struct MainMenuData
        int enable_shaders;
        bool preload_item_visuals;
        bool enable_particles;
+       bool liquid_finite;
        // Server options
        bool creative_mode;
        bool enable_damage;
@@ -71,7 +72,13 @@ struct MainMenuData
 
        MainMenuData():
                // Generic
-               selected_tab(0),
+               selected_tab(
+#if USE_CURL
+                   1
+#else
+                   0
+#endif
+               ),
                // Client opts
                fancy_trees(false),
                smooth_lighting(false),
@@ -84,7 +91,13 @@ struct MainMenuData
                // Actions
                only_refresh(false),
 
-               serverlist_show_available(false)
+               serverlist_show_available(
+#if USE_CURL
+                   true
+#else
+                   false
+#endif
+)
        {}
 };
 
index e4dbb8a546349c2d9d73f3e97559bc4e04e06ea0..1d625275758c70896d794370560c89cb30433f67 100644 (file)
@@ -1557,6 +1557,7 @@ int main(int argc, char *argv[])
                                menudata.enable_shaders = g_settings->getS32("enable_shaders");
                                menudata.preload_item_visuals = g_settings->getBool("preload_item_visuals");
                                menudata.enable_particles = g_settings->getBool("enable_particles");
+                               menudata.liquid_finite = g_settings->getBool("liquid_finite");
                                driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, menudata.mip_map);
                                menudata.creative_mode = g_settings->getBool("creative_mode");
                                menudata.enable_damage = g_settings->getBool("enable_damage");
@@ -1724,6 +1725,8 @@ int main(int argc, char *argv[])
                                }
 
                                playername = wide_to_narrow(menudata.name);
+                               if (playername == "")
+                                       playername = std::string("Guest") + itos(myrand_range(1000,9999));
                                password = translatePassword(playername, menudata.password);
                                //infostream<<"Main: password hash: '"<<password<<"'"<<std::endl;
 
@@ -1747,6 +1750,7 @@ int main(int argc, char *argv[])
                                g_settings->setS32("enable_shaders", menudata.enable_shaders);
                                g_settings->set("preload_item_visuals", itos(menudata.preload_item_visuals));
                                g_settings->set("enable_particles", itos(menudata.enable_particles));
+                               g_settings->set("liquid_finite", itos(menudata.liquid_finite));
 
                                g_settings->set("creative_mode", itos(menudata.creative_mode));
                                g_settings->set("enable_damage", itos(menudata.enable_damage));