Set server_announce to world.mt and respect modes when changing subgame
authorSokomine <wegwerf@anarres.dyndns.org>
Thu, 2 Jul 2015 14:26:09 +0000 (16:26 +0200)
committerest31 <MTest31@outlook.com>
Thu, 2 Jul 2015 21:03:42 +0000 (23:03 +0200)
builtin/mainmenu/common.lua
builtin/mainmenu/tab_server.lua
builtin/mainmenu/tab_singleplayer.lua

index cbc95bc8501a2bf5b46ee4dc95e341b7c4aa00de..14a64361d7828346986cf241ffc17d3c6a3b5fca 100644 (file)
@@ -322,7 +322,7 @@ function menu_worldmt(selected, setting, value)
 end
 
 function menu_worldmt_legacy(selected)
-       local modes_names = {"creative_mode", "enable_damage"}
+       local modes_names = {"creative_mode", "enable_damage", "server_announce"}
        for _, mode_name in pairs(modes_names) do
                local mode_val = menu_worldmt(selected, mode_name)
                if mode_val ~= nil then
index 3459f3f2f56c11bc89a95106bd6d4773057bef1b..62747c5720613184862b059f077ed039203b45b5 100644 (file)
@@ -103,6 +103,9 @@ local function main_button_handler(this, fields, name, tabdata)
 
        if fields["cb_server_announce"] then
                core.setting_set("server_announce", fields["cb_server_announce"])
+               local selected = core.get_textlist_index("srv_worlds")
+               menu_worldmt(selected, "server_announce", fields["cb_server_announce"])
+
                return true
        end
 
index a7cf5120c2e86e1d1d6eda981808ef90190fce0d..a7fa556669340b254d5fea9c27f3ebb083bb4adb 100644 (file)
@@ -38,6 +38,14 @@ local function singleplayer_refresh_gamebar()
                                        core.set_topleft_text(gamemgr.games[j].name)
                                        core.setting_set("menu_last_game",gamemgr.games[j].id)
                                        menudata.worldlist:set_filtercriteria(gamemgr.games[j].id)
+                                       local index = filterlist.get_current_index(menudata.worldlist,
+                                               tonumber(core.setting_get("mainmenu_last_selected_world")))
+                                       local selected = core.get_textlist_index("sp_worlds")
+                                       if not index or index < 1 then
+                                               index = math.min(core.get_textlist_index("sp_worlds"),
+                                                       #menudata.worldlist:get_list())
+                                       end
+                                       menu_worldmt_legacy(index)
                                        return true
                                end
                        end