Skip to content

Commit

Permalink
Add -srvprefs argument to notc server.
Browse files Browse the repository at this point in the history
  • Loading branch information
fr1tz committed Nov 19, 2014
1 parent 8fec772 commit 68dc976
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions My Projects/main/game/notc/tol.srv.cs
Expand Up @@ -96,6 +96,7 @@ function createServer(%gameType, %args)
%serverType = "MultiPlayer";
%mode = "ETH";
%map = "eth1";
%prefs = "";

// Parse arguments.
for(%i = 0; %i < getWordCount(%args); %i++)
Expand All @@ -118,13 +119,20 @@ function createServer(%gameType, %args)
%nextarg = getWord(%args, %i+1);
if(%nextarg !$= "")
%map = %nextarg;

case "-srvprefs":
%nextarg = getWord(%args, %i+1);
if(%nextarg !$= "")
%prefs = %nextarg;
}
}

// The common module provides the basic server functionality
initBaseServer();

exec("./defaults.cs");
if(isFile(%prefs))
exec(%prefs);

// Server::GameType is sent to the master server.
// This variable should uniquely identify your game and/or mod.
Expand All @@ -150,6 +158,7 @@ function createServer(%gameType, %args)
loadDatablockFiles( %datablockFiles, true );

$Server::NOTC::Mode = %mode;
$Server::NOTC::Prefs = %prefs;

// Load up game mode scripts
switch$(%mode)
Expand Down Expand Up @@ -218,7 +227,10 @@ function createServer(%gameType, %args)
function resetServerDefaults()
{
echo( "Resetting server defaults..." );

exec( "./defaults.cs" );
if(isFile($Server::NOTC::Prefs))
exec($Server::NOTC::Prefs);

// Reload the current level
loadMission( $Server::MissionFile );
Expand Down

0 comments on commit 68dc976

Please sign in to comment.