summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2017-04-06 20:39:29 +0200
committer/dev/humancontroller <devhc@example.com>2017-04-06 20:59:01 +0200
commite984293788358a72dcb57ad5d74402a3f10f0d97 (patch)
tree125ca886f39bf13f5f8f47f593788d20af684ead /src/server
parente8d1308d559e623843737e0fc6793435437a0629 (diff)
implement Schachtmeister v2 basics
Diffstat (limited to 'src/server')
-rw-r--r--src/server/sv_ccmds.c28
-rw-r--r--src/server/sv_main.c12
2 files changed, 40 insertions, 0 deletions
diff --git a/src/server/sv_ccmds.c b/src/server/sv_ccmds.c
index 56c73aa8..65585308 100644
--- a/src/server/sv_ccmds.c
+++ b/src/server/sv_ccmds.c
@@ -284,6 +284,33 @@ static void SV_KillServer_f( void ) {
SV_Shutdown( "killserver" );
}
+static void SV_SMQ_f( void ) {
+ static qboolean schmResolved = qfalse;
+ static netadr_t schmAddress;
+ char args[ MAX_STRING_CHARS ];
+ char *p;
+ int s, i;
+
+ if ( !schmResolved ) {
+ schmResolved = qtrue;
+ NET_StringToAdr( "127.0.0.1:1337", &schmAddress, NA_IP );
+ }
+
+ p = args;
+ s = sizeof( args );
+
+ for ( i = 1; i < Cmd_Argc(); ++i )
+ {
+ int l;
+ Com_sprintf( p, s, " \"%s\"", Cmd_Argv( i ) );
+ l = strlen( p );
+ s -= l;
+ p += l;
+ }
+
+ NET_OutOfBandPrint( NS_SERVER, schmAddress, "sm2query%s", args );
+}
+
//===========================================================
/*
@@ -320,6 +347,7 @@ void SV_AddOperatorCommands( void ) {
Cmd_AddCommand ("devmap", SV_Map_f);
Cmd_SetCommandCompletionFunc( "devmap", SV_CompleteMapName );
Cmd_AddCommand ("killserver", SV_KillServer_f);
+ Cmd_AddCommand ("smq", SV_SMQ_f);
}
/*
diff --git a/src/server/sv_main.c b/src/server/sv_main.c
index e5e7e5f1..41c51508 100644
--- a/src/server/sv_main.c
+++ b/src/server/sv_main.c
@@ -752,6 +752,16 @@ static void SVC_RemoteCommand( netadr_t from, msg_t *msg ) {
Com_EndRedirect ();
}
+static void SVC_SchachtmeisterResponse( netadr_t from ) {
+ if ( !( from.type == NA_IP && from.ip[0] == 127 ) ) {
+ return;
+ }
+
+ strcpy( Cmd_Argv( 0 ), "smr" );
+
+ SV_GameCommand();
+}
+
/*
=================
SV_ConnectionlessPacket
@@ -793,6 +803,8 @@ static void SV_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
// if a client starts up a local server, we may see some spurious
// server disconnect messages when their new server sees our final
// sequenced messages to the old client
+ } else if (!Q_stricmp(c, "sm2reply")) {
+ SVC_SchachtmeisterResponse( from );
} else {
Com_DPrintf ("bad connectionless packet from %s:\n%s\n",
NET_AdrToString (from), s);