]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/main.cpp
Refactor utf8_to_wide/wide_to_utf8 functions
[dragonfireclient.git] / src / main.cpp
index b3b17c2d1e4c04b99ace9bc2d22dfc94e65680fb..39b441d2c4b1d0879f6d1cf4abacd6852dd50a06 100644 (file)
@@ -47,11 +47,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "gui/guiEngine.h"
 #include "gui/mainmenumanager.h"
 #endif
-
 #ifdef HAVE_TOUCHSCREENGUI
        #include "gui/touchscreengui.h"
 #endif
 
+// for version information only
+extern "C" {
+#if USE_LUAJIT
+       #include <luajit.h>
+#else
+       #include <lua.h>
+#endif
+}
+
 #if !defined(SERVER) && \
        (IRRLICHT_VERSION_MAJOR == 1) && \
        (IRRLICHT_VERSION_MINOR == 8) && \
@@ -197,7 +205,7 @@ int main(int argc, char *argv[])
        }
 #endif
 
-       GameParams game_params;
+       GameStartData game_params;
 #ifdef SERVER
        porting::attachOrCreateConsole();
        game_params.is_dedicated_server = true;
@@ -350,6 +358,11 @@ static void print_version()
                << " (" << porting::getPlatformName() << ")" << std::endl;
 #ifndef SERVER
        std::cout << "Using Irrlicht " IRRLICHT_SDK_VERSION << std::endl;
+#endif
+#if USE_LUAJIT
+       std::cout << "Using " << LUAJIT_VERSION << std::endl;
+#else
+       std::cout << "Using " << LUA_RELEASE << std::endl;
 #endif
        std::cout << g_build_info << std::endl;
 }
@@ -474,12 +487,15 @@ static bool create_userdata_path()
 static bool init_common(const Settings &cmd_args, int argc, char *argv[])
 {
        startup_message();
-       set_default_settings(g_settings);
+       set_default_settings();
 
        // Initialize sockets
        sockets_init();
        atexit(sockets_cleanup);
 
+       // Initialize g_settings
+       Settings::createLayer(SL_GLOBAL);
+
        if (!read_config_file(cmd_args))
                return false;
 
@@ -604,10 +620,14 @@ static bool game_configure(GameParams *game_params, const Settings &cmd_args)
 
 static void game_configure_port(GameParams *game_params, const Settings &cmd_args)
 {
-       if (cmd_args.exists("port"))
+       if (cmd_args.exists("port")) {
                game_params->socket_port = cmd_args.getU16("port");
-       else
-               game_params->socket_port = g_settings->getU16("port");
+       } else {
+               if (game_params->is_dedicated_server)
+                       game_params->socket_port = g_settings->getU16("port");
+               else
+                       game_params->socket_port = g_settings->getU16("remote_port");
+       }
 
        if (game_params->socket_port == 0)
                game_params->socket_port = DEFAULT_SERVER_PORT;