From ba4ccd5621b128a86199e571daa774733d17edda Mon Sep 17 00:00:00 2001 From: hiker Date: Wed, 18 Nov 2015 17:24:56 +1100 Subject: [PATCH] Added command line option to start a LAN server. --- src/main.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 1c012bb7f..f8bfcc960 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -533,6 +533,7 @@ void cmdLineHelp() // " n=1: recorded positions\n" // " n=2: recorded key strokes\n" " --server=name Start a server (not a playing client).\n" + " --lan-server=name Start a LAN server (not a playing client).\n" " --login=s Automatically log in (set the login).\n" " --password=s Automatically log in (set the password).\n" " --port=n Port number to use.\n" @@ -774,13 +775,23 @@ int handleCmdLine() } // Networking command lines - if(CommandLine::has("--server", &s) ) + NetworkConfig::get()-> + setMaxPlayers(UserConfigParams::m_server_max_players); + if(CommandLine::has("--server", &s)) { - NetworkConfig::get()-> - setMaxPlayers(UserConfigParams::m_server_max_players); NetworkConfig::get()->setServerName(core::stringw(s.c_str())); + NetworkConfig::get()->setIsServer(true); + NetworkConfig::get()->setIsWAN(); STKHost::create(); - Log::info("main", "Creating a server '%s'.", s.c_str()); + Log::info("main", "Creating a WAN server '%s'.", s.c_str()); + } + if (CommandLine::has("--lan-server", &s)) + { + NetworkConfig::get()->setServerName(core::stringw(s.c_str())); + NetworkConfig::get()->setIsServer(true); + NetworkConfig::get()->setIsLAN(); + STKHost::create(); + Log::info("main", "Creating a LAN server '%s'.", s.c_str()); } if(CommandLine::has("--max-players", &n))