Fix singleplayer dialogs missing game customization 1310/head
authorsapier <Sapier at GMX dot net>
Sat, 17 May 2014 13:30:26 +0000 (15:30 +0200)
committersapier <Sapier at GMX dot net>
Sat, 17 May 2014 13:32:51 +0000 (15:32 +0200)
builtin/mainmenu/tab_server.lua
builtin/mainmenu/tab_singleplayer.lua

index 1efe803b7585c5f0a5a960f4a9cf9c592e52e002..c1dd6f50119c9385d794c4ab61144f80f44730be 100644 (file)
@@ -118,7 +118,6 @@ local function main_button_handler(this, fields, name, tabdata)
        end
 
        if fields["world_create"] ~= nil then
-               print("create world dialog")
                local create_world_dlg = create_create_world_dlg(true)
                create_world_dlg:set_parent(this)
                create_world_dlg:show()
index 72f9188061d9eb3a60b24d55fd2d85d3aa5e678c..244221c373612c52065707f231fb6087b07c0fcf 100644 (file)
 --with this program; if not, write to the Free Software Foundation, Inc.,
 --51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
+local function current_game()
+       local last_game_id = core.setting_get("menu_last_game")
+       local game, index = gamemgr.find_by_gameid(last_game_id)
+       
+       return game
+end
+
 local function singleplayer_refresh_gamebar()
        
        local old_bar = ui.find_by_name("game_button_bar")
@@ -137,11 +144,11 @@ local function main_button_handler(this, fields, name, tabdata)
        end
 
        if fields["world_create"] ~= nil then
-               print("create world dialog")
                local create_world_dlg = create_create_world_dlg(true)
                create_world_dlg:set_parent(this)
-               create_world_dlg:show()
                this:hide()
+               create_world_dlg:show()
+               mm_texture.update("singleplayer",current_game())
                return true
        end
 
@@ -156,8 +163,9 @@ local function main_button_handler(this, fields, name, tabdata)
                                local index = menudata.worldlist:get_raw_index(selected)
                                local delete_world_dlg = create_delete_world_dlg(world.name,index)
                                delete_world_dlg:set_parent(this)
-                               delete_world_dlg:show()
                                this:hide()
+                               delete_world_dlg:show()
+                               mm_texture.update("singleplayer",current_game())
                        end
                end
                
@@ -173,8 +181,9 @@ local function main_button_handler(this, fields, name, tabdata)
                        
                        if (configdialog ~= nil) then
                                configdialog:set_parent(this)
-                               configdialog:show()
                                this:hide()
+                               configdialog:show()
+                               mm_texture.update("singleplayer",current_game())
                        end
                end
                
@@ -191,13 +200,12 @@ local function on_change(type, old_tab, new_tab)
        end
        
        if (type == "ENTER") then
-               local last_game_id = core.setting_get("menu_last_game")
-               local game, index = gamemgr.find_by_gameid(last_game_id)
+               local game = current_game()
                
                if game then
                        menudata.worldlist:set_filtercriteria(game.id)
                        core.set_topleft_text(game.name)
-                       mm_texture.update(new_tab,game)
+                       mm_texture.update("singleplayer",game)
                end
                buttonbar:show()
        else