Skip to content

Commit

Permalink
Set server_announce to world.mt and respect modes when changing subgame
Browse files Browse the repository at this point in the history
  • Loading branch information
Sokomine authored and est31 committed Jul 2, 2015
1 parent 8a85e5e commit 0a0378f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/mainmenu/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions builtin/mainmenu/tab_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 8 additions & 0 deletions builtin/mainmenu/tab_singleplayer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0a0378f

Please sign in to comment.