Fix Lint broken by b662a4577d692329b9ca83525e6039f2ddcd1ac1
[oweals/minetest.git] / src / guiEngine.cpp
index b9d796ccb87ad4e7f9ea48413b69cf1aafbb82ad..ebc4aac4416e3e9ea9811e4cf45aa66970c33c95 100644 (file)
@@ -60,7 +60,7 @@ void TextDestGuiEngine::gotText(const StringMap &fields)
 }
 
 /******************************************************************************/
-void TextDestGuiEngine::gotText(std::wstring text)
+void TextDestGuiEngine::gotText(const std::wstring &text)
 {
        m_engine->getScriptIface()->handleMainMenuEvent(wide_to_utf8(text));
 }
@@ -174,8 +174,7 @@ GUIEngine::GUIEngine(       irr::IrrlichtDevice* dev,
                m_sound_manager = &dummySoundManager;
 
        //create topleft header
-       m_toplefttext = utf8_to_wide(std::string(PROJECT_NAME_C " ") +
-                       g_version_hash);
+       m_toplefttext = L"";
 
        core::rect<s32> rect(0, 0, g_fontengine->getTextWidth(m_toplefttext.c_str()),
                g_fontengine->getTextHeight());
@@ -195,11 +194,9 @@ GUIEngine::GUIEngine(      irr::IrrlichtDevice* dev,
                        -1,
                        m_menumanager,
                        NULL /* &client */,
-                       NULL /* gamedef */,
                        m_texture_source,
                        m_formspecgui,
                        m_buttonhandler,
-                       NULL,
                        false);
 
        m_menu->allowClose(false);
@@ -216,13 +213,13 @@ GUIEngine::GUIEngine(     irr::IrrlichtDevice* dev,
                m_data->script_data.errormessage = "";
 
                if (!loadMainMenuScript()) {
-                       errorstream << "No future without mainmenu" << std::endl;
+                       errorstream << "No future without main menu!" << std::endl;
                        abort();
                }
 
                run();
        } catch (LuaError &e) {
-               errorstream << "MAINMENU ERROR: " << e.what() << std::endl;
+               errorstream << "Main menu error: " << e.what() << std::endl;
                m_data->script_data.errormessage = e.what();
        }
 
@@ -234,13 +231,13 @@ GUIEngine::GUIEngine(     irr::IrrlichtDevice* dev,
 /******************************************************************************/
 bool GUIEngine::loadMainMenuScript()
 {
-       // Try custom menu script (main_menu_path)
-
+       // Set main menu path (for core.get_mainmenu_path())
        m_scriptdir = g_settings->get("main_menu_path");
        if (m_scriptdir.empty()) {
-               m_scriptdir = porting::path_share + DIR_DELIM "builtin" + DIR_DELIM "mainmenu";
+               m_scriptdir = porting::path_share + DIR_DELIM + "builtin" + DIR_DELIM + "mainmenu";
        }
 
+       // Load builtin (which will load the main menu script)
        std::string script = porting::path_share + DIR_DELIM "builtin" + DIR_DELIM "init.lua";
        try {
                m_script->loadScript(script);
@@ -434,7 +431,7 @@ void GUIEngine::drawOverlay(video::IVideoDriver* driver)
 
        video::ITexture* texture = m_textures[TEX_LAYER_OVERLAY].texture;
 
-       /* If no texture, draw background of solid color */
+       /* If no texture, draw nothing */
        if(!texture)
                return;
 
@@ -463,7 +460,7 @@ void GUIEngine::drawHeader(video::IVideoDriver* driver)
        v2s32 splashsize(((f32)texture->getOriginalSize().Width) * mult,
                        ((f32)texture->getOriginalSize().Height) * mult);
 
-       // Don't draw the header is there isn't enough room
+       // Don't draw the header if there isn't enough room
        s32 free_space = (((s32)screensize.Height)-320)/2;
 
        if (free_space > splashsize.Y) {
@@ -543,7 +540,7 @@ bool GUIEngine::setTexture(texture_layer layer, std::string texturepath,
 }
 
 /******************************************************************************/
-bool GUIEngine::downloadFile(std::string url, std::string target)
+bool GUIEngine::downloadFile(const std::string &url, const std::string &target)
 {
 #if USE_CURL
        std::ofstream target_file(target.c_str(), std::ios::out | std::ios::binary);
@@ -571,18 +568,9 @@ bool GUIEngine::downloadFile(std::string url, std::string target)
 }
 
 /******************************************************************************/
-void GUIEngine::setTopleftText(std::string append)
+void GUIEngine::setTopleftText(const std::string &text)
 {
-       std::wstring toset = utf8_to_wide(std::string(PROJECT_NAME_C " ") +
-               g_version_hash);
-
-       if (append != "")
-       {
-               toset += L" / ";
-               toset += utf8_to_wide(append);
-       }
-
-       m_toplefttext = toset;
+       m_toplefttext = utf8_to_wide(text);
 
        updateTopLeftTextSize();
 }
@@ -614,8 +602,8 @@ void GUIEngine::stopSound(s32 handle)
 }
 
 /******************************************************************************/
-unsigned int GUIEngine::queueAsync(std::string serialized_func,
-               std::string serialized_params)
+unsigned int GUIEngine::queueAsync(const std::string &serialized_func,
+               const std::string &serialized_params)
 {
        return m_script->queueAsync(serialized_func, serialized_params);
 }