Skip to content

Commit 4c8c649

Browse files
authored
Mainmenu game-related changes (#11887)
fixes: * Switching between games does not immediately hide creative mode / damage buttons if so specified * World creation menu has a game selection list even though the menu already provides a gamebar * Showing gameid in world list is unnecessary * Choice of mapgen parameters in menu persists between games (and was half-broken)
1 parent b164e16 commit 4c8c649

File tree

9 files changed

+259
-207
lines changed

9 files changed

+259
-207
lines changed

builtin/mainmenu/common.lua

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,21 @@ os.tmpname = function()
125125
end
126126
--------------------------------------------------------------------------------
127127

128-
function menu_render_worldlist()
129-
local retval = ""
128+
function menu_render_worldlist(show_gameid)
129+
local retval = {}
130130
local current_worldlist = menudata.worldlist:get_list()
131131

132+
local row
132133
for i, v in ipairs(current_worldlist) do
133-
if retval ~= "" then retval = retval .. "," end
134-
retval = retval .. core.formspec_escape(v.name) ..
135-
" \\[" .. core.formspec_escape(v.gameid) .. "\\]"
134+
row = v.name
135+
if show_gameid == nil or show_gameid == true then
136+
row = row .. " [" .. v.gameid .. "]"
137+
end
138+
retval[#retval+1] = core.formspec_escape(row)
139+
136140
end
137141

138-
return retval
142+
return table.concat(retval, ",")
139143
end
140144

141145
function menu_handle_key_up_down(fields, textlist, settingname)

0 commit comments

Comments
 (0)