]> git.lizzy.rs Git - minetest.git/blobdiff - src/client/clientlauncher.cpp
Drop dependency on IrrCompileConfig
[minetest.git] / src / client / clientlauncher.cpp
index dbf1d1cd1e5fdd5846e62c164f743236aa463c4f..15263de9bfcd54a59238f10047a5533fbd22d84b 100644 (file)
@@ -38,9 +38,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #if USE_SOUND
        #include "sound_openal.h"
 #endif
-#ifdef __ANDROID__
-       #include "porting.h"
-#endif
 
 /* mainmenumanager.h
  */
@@ -73,10 +70,10 @@ static void dump_start_data(const GameStartData &data)
 
 ClientLauncher::~ClientLauncher()
 {
-       delete receiver;
-
        delete input;
 
+       delete receiver;
+
        delete g_fontengine;
        delete g_gamecallback;
 
@@ -99,10 +96,6 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
 
        init_args(start_data, cmd_args);
 
-       // List video modes if requested
-       if (list_video_modes)
-               return m_rendering_engine->print_video_modes();
-
 #if USE_SOUND
        if (g_settings->getBool("enable_sound"))
                g_sound_manager_singleton = createSoundManagerSingleton();
@@ -151,8 +144,8 @@ bool ClientLauncher::run(GameStartData &start_data, const Settings &cmd_args)
        skin->setColor(gui::EGDC_3D_SHADOW, video::SColor(255, 0, 0, 0));
        skin->setColor(gui::EGDC_HIGH_LIGHT, video::SColor(255, 70, 120, 50));
        skin->setColor(gui::EGDC_HIGH_LIGHT_TEXT, video::SColor(255, 255, 255, 255));
-#ifdef __ANDROID__
-       float density = porting::getDisplayDensity();
+#ifdef HAVE_TOUCHSCREENGUI
+       float density = RenderingEngine::getDisplayDensity();
        skin->setSize(gui::EGDS_CHECK_BOX_WIDTH, (s32)(17.0f * density));
        skin->setSize(gui::EGDS_SCROLLBAR_SIZE, (s32)(14.0f * density));
        skin->setSize(gui::EGDS_WINDOW_BUTTON_WIDTH, (s32)(15.0f * density));
@@ -336,8 +329,6 @@ void ClientLauncher::init_args(GameStartData &start_data, const Settings &cmd_ar
        if (cmd_args.exists("name"))
                start_data.name = cmd_args.get("name");
 
-       list_video_modes = cmd_args.getFlag("videomodes");
-
        random_input = g_settings->getBool("random_input")
                        || cmd_args.getFlag("random-input");
 }
@@ -426,7 +417,7 @@ bool ClientLauncher::launch_game(std::string &error_message,
                menudata.name                            = start_data.name;
                menudata.password                        = start_data.password;
                menudata.port                            = itos(start_data.socket_port);
-               menudata.script_data.errormessage        = error_message_lua;
+               menudata.script_data.errormessage        = std::move(error_message_lua);
                menudata.script_data.reconnect_requested = reconnect_requested;
 
                main_menu(&menudata);
@@ -460,6 +451,7 @@ bool ClientLauncher::launch_game(std::string &error_message,
                start_data.name = menudata.name;
                start_data.password = menudata.password;
                start_data.address = std::move(menudata.address);
+               start_data.allow_login_or_register = menudata.allow_login_or_register;
                server_name = menudata.servername;
                server_description = menudata.serverdescription;
 
@@ -518,8 +510,8 @@ bool ClientLauncher::launch_game(std::string &error_message,
                // Load gamespec for required game
                start_data.game_spec = findWorldSubgame(worldspec.path);
                if (!start_data.game_spec.isValid()) {
-                       error_message = gettext("Could not find or load game \"")
-                                       + worldspec.gameid + "\"";
+                       error_message = gettext("Could not find or load game")
+                                       + worldspec.gameid;
                        errorstream << error_message << std::endl;
                        return false;
                }
@@ -556,9 +548,12 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
        }
        infostream << "Waited for other menus" << std::endl;
 
-       // Cursor can be non-visible when coming from the game
 #ifndef ANDROID
+       // Cursor can be non-visible when coming from the game
        m_rendering_engine->get_raw_device()->getCursorControl()->setVisible(true);
+
+       // Set absolute mouse mode
+       m_rendering_engine->get_raw_device()->getCursorControl()->setRelativeMode(false);
 #endif
 
        /* show main menu */
@@ -573,6 +568,8 @@ void ClientLauncher::speed_tests()
        // volatile to avoid some potential compiler optimisations
        volatile static s16 temp16;
        volatile static f32 tempf;
+       // Silence compiler warning
+       (void)temp16;
        static v3f tempv3f1;
        static v3f tempv3f2;
        static std::string tempstring;
@@ -588,8 +585,8 @@ void ClientLauncher::speed_tests()
                TimeTaker timer("Testing std::string speed");
                const u32 jj = 10000;
                for (u32 j = 0; j < jj; j++) {
-                       tempstring = "";
-                       tempstring2 = "";
+                       tempstring.clear();
+                       tempstring2.clear();
                        const u32 ii = 10;
                        for (u32 i = 0; i < ii; i++) {
                                tempstring2 += "asd";