7typedef struct mapcycle_s {
22 const char* map =
nullptr, *gameType =
nullptr;
32 if (mapcycle->
map[0] ==
'+') {
34 char* base = strstr(expanded,
" ");
38 Q_strncpyz(assembly, base + 1,
sizeof(assembly));
43 map = mapcycle->
next->map;
44 day = mapcycle->
next->day;
45 gameType = mapcycle->
next->type;
57 Com_Printf(
"ignore mapcycle entry for random map (%s) with"
58 " no assembly given\n", mapcycle->
map);
65 map = mapcycle->
next->map;
66 day = mapcycle->
next->day;
67 gameType = mapcycle->
next->type;
76 Com_sprintf(expanded,
sizeof(expanded),
"maps/%s.bsp", map);
80 Com_Printf(
"SV_NextMapcycle: Can't find '%s' - mapcycle error\n"
81 "Use the 'maplist' command to get a list of valid maps\n", expanded);
88 mapcycle = mapcycle->
next;
98 Com_sprintf(expanded,
sizeof(expanded),
"maps/%s.bsp", map);
102 Com_Printf(
"SV_NextMapcycle: Can't find '%s' - mapcycle error\n"
103 "Use the 'maplist' command to get a list of valid maps\n", expanded);
107 }
else if (
sv->name[0]) {
108 Com_Printf(
"No mapcycle - restart the current map (%s)\n",
sv->name);
112 Com_Printf(
"No mapcycle and no running map\n");
121 if (gameType && gameType[0] !=
'\0') {
122 Cvar_Set(
"sv_gametype",
"%s", gameType);
143 mapcycle = mapcycle->
next;
170 while (*anchor) anchor = &(*anchor)->
next;
184 byte* buffer =
nullptr;
191 if (
length == -1 || !buffer)
195 buf = (
const char*)buffer;
211 else if (!
Q_streq(token,
"night")) {
212 Com_Printf(
"Skip mapcycle parsing, expected day or night.");
219 Q_strncpyz(gameType, token,
sizeof(gameType));
235 mapcycle = mapcycle->
next;
246 Com_Printf(
"map '%s' isn't a valid map\n", map);
249 Com_Printf(
"adding map '%s' with gametype '%s' to mapcycle (to add this permanently edit your mapcycle.txt)\n", map, gametype);
256 Com_Printf(
" ...to get a list of valid maps type 'maplist'\n"
257 " ...to get a list of valid gametypes 'gametypelist'\n");
const char * Cmd_Argv(int arg)
Returns a given argument.
int Cmd_Argc(void)
Return the number of arguments of the current command. "command parameter" will result in a argc of 2...
void Cmd_AddCommand(const char *cmdName, xcommand_t function, const char *desc)
Add a new command to the script interface.
void Cbuf_AddText(const char *format,...)
Adds command text at the end of the buffer.
void Com_DPrintf(int level, const char *fmt,...)
A Com_Printf that only shows up if the "developer" cvar is set.
void Com_SetGameType(void)
void Com_Printf(const char *const fmt,...)
cvar_t * Cvar_Set(const char *varName, const char *value,...)
Sets a cvar value.
int FS_CheckFile(const char *fmt,...)
Just returns the filelength and -1 if the file wasn't found.
int FS_LoadFile(const char *path, byte **buffer)
Filenames are relative to the quake search path.
void FS_FreeFile(void *buffer)
#define Mem_PoolStrDup(in, pool, tagNum)
#define Mem_PoolAllocType(type, pool)
const char * Com_Parse(const char *data_p[], char *target, size_t size, bool replaceWhitespaces)
Parse a token out of a string.
Shared parsing functions.
QGL_EXTERN GLuint GLsizei GLsizei * length
Main server include file.
memPool_t * sv_genericPool
void SV_MapcycleClear(void)
Empty the mapcycle list.
bool SV_CheckMap(const char *map, const char *assembly)
Checks whether a map exists.
serverInstanceGame_t * sv
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
void SV_MapcycleClear(void)
Empty the mapcycle list.
static void SV_MapcycleNext_f(void)
void SV_MapcycleInit(void)
static void SV_MapcycleAdd(const char *mapName, bool day, const char *gameType)
Append a new mapname to the list of maps for the cycle.
static void SV_ParseMapcycle(void)
Parses the server mapcycle.
void SV_NextMapcycle(void)
Start the next map in the cycle.
static void SV_MapcycleAdd_f(void)
static void SV_MapcycleList_f(void)
static mapcycle_t * mapcycleList
static const char * mapName