32 #include "../common/http.h"
33 #include "../shared/scopedmutex.h"
71 if (s[0] >=
'0' && s[0] <=
'9') {
78 Com_Printf(
"Client %i is not active\n", idnum);
94 Com_Printf(
"Userid %s is not on the server\n", s);
107 Com_sprintf(expanded,
sizeof(expanded),
"maps/%s.ump", map + 1);
114 }
else if (!assembly) {
115 Com_sprintf(expanded,
sizeof(expanded),
"maps/%s.bsp", map);
135 Com_Printf(
"Use 'maplist' to get a list of all installed maps\n");
140 Com_Printf(
"deactivate ai - make sure to reset sv_ai after maptesting\n");
159 Com_Printf(
"Invalid lightmap parameter - use day or night\n");
167 const char* assembly =
nullptr;
173 assembly = bufAssembly;
181 SV_Map(day, bufMap, assembly);
246 Com_Printf(
"num status name timeout ready address \n");
247 Com_Printf(
"--- ------- --------------- -------------- ----- ---------------------\n");
262 state =
"CONNECT";
break;
264 state =
"SPAWNIN";
break;
266 state =
"BEGAN ";
break;
268 state =
"SPAWNED";
break;
271 sprintf(state_buf,
"%7i", cl->
state);
283 #ifdef DEDICATED_ONLY
287 static void SV_ConSay_f (
void)
300 Q_strncpyz(text,
"serverconsole: ",
sizeof(text));
306 Q_strcat(text,
sizeof(text),
"%s", p);
307 if (text[strlen(text)] ==
'"')
308 text[strlen(text)] = 0;
379 svs.
ge->ServerCommand();
392 const char* dayNightStr =
nullptr;
393 static char dayNightMatch[7];
396 dayNightStr = strstr(partial,
" ");
398 if (partial[0] ==
'd') {
399 Q_strncpyz(dayNightMatch,
"day ",
sizeof(dayNightMatch));
400 *match = dayNightMatch;
402 }
else if (partial[0] ==
'n') {
403 Q_strncpyz(dayNightMatch,
"night ",
sizeof(dayNightMatch));
404 *match = dayNightMatch;
409 dayNightMatch[0] =
'\0';
410 *match = dayNightMatch;
415 partial = dayNightStr + 1;
419 dayNightMatch[0] =
'\0';
420 *match = dayNightMatch;
461 {
"startgame",
"Force the gamestart - useful for multiplayer games" },
462 {
"addip",
"The ip address is specified in dot format, and any unspecified digits will match any value, so you can specify an entire class C network with 'addip 192.246.40'" },
463 {
"removeip",
"Removeip will only remove an address specified exactly the same way. You cannot addip a subnet, then removeip a single host" },
464 {
"listip",
"Prints the current list of filters" },
465 {
"writeip",
"Dumps ips to listip.cfg so it can be executed at a later date" },
466 {
"ai_add",
"Used to add ai opponents to a game - but no civilians" },
467 {
"win",
"Call the end game function with the given team" },
469 {
"debug_showall",
"Debug function: Reveal all items to all sides" },
470 {
"debug_actorinvlist",
"Debug function to show the whole inventory of all connected clients on the server" },
499 const char* configString;
507 if (configString[0] ==
'\0')
509 Com_Printf(
"configstring[%3i]: %s\n",
i, configString);
515 #include "../common/routing.h"
521 static void Grid_DumpWholeServerMap_f (
void)
530 static void Grid_DumpServerRoutes_f (
void)
559 #ifdef DEDICATED_ONLY
560 Cmd_AddCommand(
"say", SV_ConSay_f,
"Broadcasts server messages to all connected players");
564 Cmd_AddCommand(
"debug_sgrid", Grid_DumpWholeServerMap_f,
"Shows the whole server side pathfinding grid of the current loaded map");
565 Cmd_AddCommand(
"debug_sroute", Grid_DumpServerRoutes_f,
"Shows the whole server side pathfinding grid of the current loaded map");
static void SV_KillServer_f(void)
Kick everyone off, possibly in preparation for a new game.
const char * Cmd_Argv(int arg)
Returns a given argument.
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
static void SV_UserInfo_f(void)
Examine all a users info strings.
void void void SV_BroadcastPrintf(int level, const char *fmt,...) __attribute__((format(__printf__
void SV_SetMaster_f(void)
Add the server to the master server list so that others can see the server in the server list...
int FS_CheckFile(const char *fmt,...)
Just returns the filelength and -1 if the file wasn't found.
static int SV_CompleteServerCommand(const char *partial, const char **match)
Autocomplete function for server commands.
char * SV_GetConfigString(int index)
const char * va(const char *format,...)
does a varargs printf into a temp buffer, so I don't need to have varargs versions of all text functi...
void RT_WriteCSVFiles(const Routing &routing, const char *baseFilename, const GridBox &box)
const char * Cvar_Serverinfo(char *info, size_t infoSize)
Returns an info string containing all the CVAR_SERVERINFO cvars.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
static void SV_ListMaps_f(void)
List all valid maps.
char userinfo[MAX_INFO_STRING]
void FS_GetMaps(bool reset)
File the fs_maps array with valid maps.
void SV_Map(bool day, const char *levelstring, const char *assembly, bool verbose=true)
Change the server to a new map, taking all connected clients along with it.
client_t * SV_GetNextClient(client_t *lastClient)
Iterates through clients.
void Com_Printf(const char *const fmt,...)
bool Cmd_GenericCompleteFunction(char const *candidate, char const *partial, char const **match)
cvar_t * masterserver_url
serverInstanceGame_t * sv
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
void SV_DropClient(client_t *drop, const char *message)
Called when the player is totally leaving the server, either willingly or unwillingly. This is NOT called if the entire server is quitting or crashing.
#define Q_strncasecmp(s1, s2, n)
List for SV_CompleteServerCommand.
static void SV_Status_f(void)
Prints some server info to the game console - like connected players and current running map...
int Cmd_Argc(void)
Return the number of arguments of the current command. "command parameter" will result in a argc of 2...
bool SV_CheckMap(const char *map, const char *assembly)
Checks whether a map exists.
#define VecToPos(v, p)
Map boundary is +/- MAX_WORLD_WIDTH - to get into the positive area we add the possible max negative ...
Main server include file.
static void SV_StartGame_f(void)
Forces a game start even if not all players are ready yet.
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
static void SV_ServerCommand_f(void)
Let the game dll handle a command.
#define MAX_CONFIGSTRINGS
void setReady(bool ready)
void SV_Heartbeat_f(void)
static void SV_PrintConfigStrings_f(void)
struct net_stream * stream
struct client_s * clients
static void SV_Map_f(void)
Goes directly to a given map.
void Q_strcat(char *dest, size_t destsize, const char *format,...)
Safely (without overflowing the destination buffer) concatenates two strings.
void SV_InitOperatorCommands(void)
void Cmd_AddParamCompleteFunction(const char *cmdName, int(*function)(const char *partial, const char **match))
void Info_Print(const char *s)
Prints info strings (like userinfo or serverinfo - CVAR_USERINFO, CVAR_SERVERINFO) ...
cvar_t * Cvar_ForceSet(const char *varName, const char *value)
Will set the variable even if NOSET or LATCH.
bool HTTP_GetURL(const char *url, http_callback_t callback, void *userdata, const char *postfields)
Downloads the given url and return the data to the callback (optional)
static serverCommand_t const serverCommandList[]
static client_t * SV_GetPlayerClientStructure(const char *s)
searches a player by id or name
const char * NET_StreamPeerToName(struct net_stream *s, char *dst, int len, bool appendPort)
cvar_t * Cvar_Set(const char *varName, const char *value,...)
Sets a cvar value.
static void SV_Serverinfo_f(void)
Examine or change the serverinfo string.
void Cvar_SetValue(const char *varName, float value)
Expands value to a string and calls Cvar_Set.
int Com_ServerState(void)
Check whether we are the server or have a singleplayer tactical mission.
static int SV_CompleteMapCommand(const char *partial, const char **match)
Autocomplete function for the map command.
serverInstanceStatic_t svs
static void SV_Kick_f(void)
Kick a user off of the server.
const char * Cmd_Args(void)
Returns a single string containing argv(1) to argv(argc()-1)
int SV_GetConfigStringInteger(int index)
static const char * mapName
void SV_Shutdown(const char *finalmsg, bool reconnect)
Called when each game quits, before Sys_Quit or Sys_Error.