Skip to content

Commit 87b4bce

Browse files
sapiersapier
sapier
authored and
sapier
committedMay 17, 2014
Fix singleplayer dialogs missing game customization
1 parent c398456 commit 87b4bce

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed
 

‎builtin/mainmenu/tab_server.lua

-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ local function main_button_handler(this, fields, name, tabdata)
118118
end
119119

120120
if fields["world_create"] ~= nil then
121-
print("create world dialog")
122121
local create_world_dlg = create_create_world_dlg(true)
123122
create_world_dlg:set_parent(this)
124123
create_world_dlg:show()

‎builtin/mainmenu/tab_singleplayer.lua

+15-7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515
--with this program; if not, write to the Free Software Foundation, Inc.,
1616
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
1717

18+
local function current_game()
19+
local last_game_id = core.setting_get("menu_last_game")
20+
local game, index = gamemgr.find_by_gameid(last_game_id)
21+
22+
return game
23+
end
24+
1825
local function singleplayer_refresh_gamebar()
1926

2027
local old_bar = ui.find_by_name("game_button_bar")
@@ -137,11 +144,11 @@ local function main_button_handler(this, fields, name, tabdata)
137144
end
138145

139146
if fields["world_create"] ~= nil then
140-
print("create world dialog")
141147
local create_world_dlg = create_create_world_dlg(true)
142148
create_world_dlg:set_parent(this)
143-
create_world_dlg:show()
144149
this:hide()
150+
create_world_dlg:show()
151+
mm_texture.update("singleplayer",current_game())
145152
return true
146153
end
147154

@@ -156,8 +163,9 @@ local function main_button_handler(this, fields, name, tabdata)
156163
local index = menudata.worldlist:get_raw_index(selected)
157164
local delete_world_dlg = create_delete_world_dlg(world.name,index)
158165
delete_world_dlg:set_parent(this)
159-
delete_world_dlg:show()
160166
this:hide()
167+
delete_world_dlg:show()
168+
mm_texture.update("singleplayer",current_game())
161169
end
162170
end
163171

@@ -173,8 +181,9 @@ local function main_button_handler(this, fields, name, tabdata)
173181

174182
if (configdialog ~= nil) then
175183
configdialog:set_parent(this)
176-
configdialog:show()
177184
this:hide()
185+
configdialog:show()
186+
mm_texture.update("singleplayer",current_game())
178187
end
179188
end
180189

@@ -191,13 +200,12 @@ local function on_change(type, old_tab, new_tab)
191200
end
192201

193202
if (type == "ENTER") then
194-
local last_game_id = core.setting_get("menu_last_game")
195-
local game, index = gamemgr.find_by_gameid(last_game_id)
203+
local game = current_game()
196204

197205
if game then
198206
menudata.worldlist:set_filtercriteria(game.id)
199207
core.set_topleft_text(game.name)
200-
mm_texture.update(new_tab,game)
208+
mm_texture.update("singleplayer",game)
201209
end
202210
buttonbar:show()
203211
else

0 commit comments

Comments
 (0)
Please sign in to comment.