Skip to content

Commit

Permalink
Added command line option to start a LAN server.
Browse files Browse the repository at this point in the history
  • Loading branch information
hiker committed Nov 18, 2015
1 parent e6c2620 commit ba4ccd5
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit ba4ccd5

Please sign in to comment.