Show game name instead of game ID of selected game
authorPilzAdam <pilzadam@minetest.net>
Thu, 2 May 2013 17:57:03 +0000 (19:57 +0200)
committerPilzAdam <pilzadam@minetest.net>
Thu, 2 May 2013 18:05:07 +0000 (20:05 +0200)
src/guiMainMenu.cpp
src/guiMainMenu.h
src/main.cpp

index c6142d4ce5a2844972ca7ac6493bbd25cfe9bf2c..5d5ae1e903021d0cae7c34e913c4ff5d20d433d1 100644 (file)
@@ -258,9 +258,9 @@ void GUIMainMenu::regenerateGui(v2u32 screensize)
                core::rect<s32> rect(0, 0, size.X, 40);
                rect += v2s32(4, 0);
                std::string t = "Minetest " VERSION_STRING;
-               if(m_data->selected_game != ""){
+               if(m_data->selected_game_name != ""){
                        t += "/";
-                       t += m_data->selected_game;
+                       t += m_data->selected_game_name;
                }
                Environment->addStaticText(narrow_to_wide(t).c_str(),
                                rect, false, true, this, -1);
@@ -1356,6 +1356,8 @@ bool GUIMainMenu::OnEvent(const SEvent& event)
                                        eid <= GUI_ID_GAME_BUTTON_MAX){
                                m_data->selected_game =
                                                m_data->games[eid - GUI_ID_GAME_BUTTON_FIRST].id;
+                               m_data->selected_game_name =
+                                               m_data->games[eid - GUI_ID_GAME_BUTTON_FIRST].name;
                                regenerateGui(m_screensize_old);
                        }
                }
index 1c5ca4d37d46e20e69494b4966b38d201dd4a99c..1d09c8baad2c802d9f8bb30bdc0b6e3a160348ee 100644 (file)
@@ -40,6 +40,7 @@ struct MainMenuData
        // Generic
        int selected_tab;
        std::string selected_game;
+       std::string selected_game_name;
        // Client options
        std::string servername;
        std::string serverdescription;
@@ -80,6 +81,7 @@ struct MainMenuData
                // Generic
                selected_tab(0),
                selected_game("minetest"),
+               selected_game_name("Minetest"),
                // Client opts
                fancy_trees(false),
                smooth_lighting(false),
index 9a646413dc54d17e69a6eb8e2026350fa0d0b33c..501e4cdf4031059572c4b541bf4f00702f12fe06 100644 (file)
@@ -1501,8 +1501,10 @@ int main(int argc, char *argv[])
                                        menudata.selected_tab = g_settings->getS32("selected_mainmenu_tab");
                                if(g_settings->exists("selected_serverlist"))
                                        menudata.selected_serverlist = g_settings->getS32("selected_serverlist");
-                               if(g_settings->exists("selected_mainmenu_game"))
+                               if(g_settings->exists("selected_mainmenu_game")){
                                        menudata.selected_game = g_settings->get("selected_mainmenu_game");
+                                       menudata.selected_game_name = findSubgame(menudata.selected_game).name;
+                               }
                                menudata.address = narrow_to_wide(address);
                                menudata.name = narrow_to_wide(playername);
                                menudata.port = narrow_to_wide(itos(port));