Bump MAX_STRING_CHARS to 2048 and MAX_TOKEN_CHARS to 1024.

This allows for longer arguments passed to cvars, gl_nolerp_list is a
good example for a case were a token length of 128 is too short. Keep
the mapname[] buffer in the server struct at 128 bytes to preserve
savegame compatibility.

Closes #526.
This commit is contained in:
Yamagi 2020-03-14 17:15:40 +01:00
parent 6b7af81cd2
commit 904f14f2ff
3 changed files with 11 additions and 4 deletions

View File

@ -80,9 +80,9 @@ typedef unsigned char byte;
#define YAW 1 /* left / right */
#define ROLL 2 /* fall over */
#define MAX_STRING_CHARS 1024 /* max length of a string passed to Cmd_TokenizeString */
#define MAX_STRING_CHARS 2048 /* max length of a string passed to Cmd_TokenizeString */
#define MAX_STRING_TOKENS 80 /* max tokens resulting from Cmd_TokenizeString */
#define MAX_TOKEN_CHARS 128 /* max length of an individual token */
#define MAX_TOKEN_CHARS 1024 /* max length of an individual token */
#define MAX_QPATH 64 /* max length of a quake game pathname */

View File

@ -39,6 +39,13 @@
out before legitimate users connected */
#define MAX_CHALLENGES 1024
/* MAX_TOKEN_CHARS was 128. YQ2 bumped it to 1024, since we
* need to support some very long cvars like gl_nolerp_list.
* Keep structs used in savegames at 128, otherwise older
* savegames would be broken. */
#define MAX_SAVE_TOKEN_CHARS 128
#define SV_OUTPUTBUF_LENGTH (MAX_MSGLEN - 16)
#define EDICT_NUM(n) ((edict_t *)((byte *)ge->edicts + ge->edict_size * (n)))
#define NUM_FOR_EDICT(e) (((byte *)(e) - (byte *)ge->edicts) / ge->edict_size)
@ -152,7 +159,7 @@ typedef struct
qboolean initialized; /* sv_init has completed */
int realtime; /* always increasing, no clamping, etc */
char mapcmd[MAX_TOKEN_CHARS]; /* ie: *intro.cin+base */
char mapcmd[MAX_SAVE_TOKEN_CHARS]; /* ie: *intro.cin+base */
int spawncount; /* incremented each server start */
/* used to check late spawns */

View File

@ -334,7 +334,7 @@ SV_ReadServerFile(void)
char name[MAX_OSPATH], string[128];
char workdir[MAX_OSPATH];
char comment[32];
char mapcmd[MAX_TOKEN_CHARS];
char mapcmd[MAX_SAVE_TOKEN_CHARS];
Com_DPrintf("SV_ReadServerFile()\n");