Skip to content

Commit bb154c2

Browse files
committedJan 13, 2017
Main menu tweaks
1 parent ef0aa7d commit bb154c2

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed
 

Diff for: ‎builtin/init.lua

+3-4
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ dofile(commonpath .. "misc_helpers.lua")
3737
if INIT == "game" then
3838
dofile(gamepath .. "init.lua")
3939
elseif INIT == "mainmenu" then
40-
local mainmenuscript = core.setting_get("main_menu_script")
41-
if mainmenuscript ~= nil and mainmenuscript ~= "" then
42-
dofile(mainmenuscript)
40+
local mm_script = core.setting_get("main_menu_script")
41+
if mm_script and mm_script ~= "" then
42+
dofile(mm_script)
4343
else
4444
dofile(core.get_mainmenu_path() .. DIR_DELIM .. "init.lua")
4545
end
@@ -48,4 +48,3 @@ elseif INIT == "async" then
4848
else
4949
error(("Unrecognized builtin initialization type %s!"):format(tostring(INIT)))
5050
end
51-

Diff for: ‎builtin/mainmenu/dlg_settings_advanced.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -667,4 +667,4 @@ end
667667
-- The documentation of mapgen noise parameter formats (title plus 16 lines)
668668
-- Noise parameter 'mgv5_np_ground' in group format (13 lines)
669669

670-
--assert(loadfile(core.get_mainmenu_path()..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))
670+
--assert(loadfile(core.get_builtin_path()..DIR_DELIM.."mainmenu"..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))

Diff for: ‎src/guiEngine.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,13 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
213213
m_data->script_data.errormessage = "";
214214

215215
if (!loadMainMenuScript()) {
216-
errorstream << "No future without mainmenu" << std::endl;
216+
errorstream << "No future without main menu!" << std::endl;
217217
abort();
218218
}
219219

220220
run();
221221
} catch (LuaError &e) {
222-
errorstream << "MAINMENU ERROR: " << e.what() << std::endl;
222+
errorstream << "Main menu error: " << e.what() << std::endl;
223223
m_data->script_data.errormessage = e.what();
224224
}
225225

@@ -231,13 +231,13 @@ GUIEngine::GUIEngine( irr::IrrlichtDevice* dev,
231231
/******************************************************************************/
232232
bool GUIEngine::loadMainMenuScript()
233233
{
234-
// Try custom menu script (main_menu_path)
235-
234+
// Set main menu path (for core.get_mainmenu_path())
236235
m_scriptdir = g_settings->get("main_menu_path");
237236
if (m_scriptdir.empty()) {
238-
m_scriptdir = porting::path_share + DIR_DELIM "builtin" + DIR_DELIM "mainmenu";
237+
m_scriptdir = porting::path_share + DIR_DELIM + "builtin" + DIR_DELIM + "mainmenu";
239238
}
240239

240+
// Load builtin (which will load the main menu script)
241241
std::string script = porting::path_share + DIR_DELIM "builtin" + DIR_DELIM "init.lua";
242242
try {
243243
m_script->loadScript(script);

0 commit comments

Comments
 (0)
Please sign in to comment.