Promote gametypes in XD_MAP, XD_MAPQUEUE and XD_REQMAPQUEUE to UINT16
Since new-voting repermitted custom gametypes to go beyond the bounds of a UINT8, here's some extra anti-footgun protection.
This commit is contained in:
parent
c877362772
commit
cf2eb1dc70
2 changed files with 14 additions and 12 deletions
|
|
@ -3382,7 +3382,7 @@ void D_MapChange(INT32 mapnum, INT32 newgametype, boolean pencoremode, boolean p
|
|||
}
|
||||
|
||||
// new gametype value
|
||||
WRITEUINT8(buf_p, newgametype);
|
||||
WRITEUINT16(buf_p, newgametype);
|
||||
|
||||
WRITEINT16(buf_p, mapnum);
|
||||
}
|
||||
|
|
@ -3924,9 +3924,10 @@ static void Command_Map_f(void)
|
|||
static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
UINT8 flags;
|
||||
INT32 presetplayer = 1, lastgametype;
|
||||
INT32 presetplayer = 1;
|
||||
UINT8 skipprecutscene, pforcespecialstage;
|
||||
boolean pencoremode, hasroundqueuedata;
|
||||
UINT16 lastgametype;
|
||||
INT16 mapnumber;
|
||||
|
||||
forceresetplayers = deferencoremode = false;
|
||||
|
|
@ -3988,7 +3989,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
|
|||
chmappending--;
|
||||
|
||||
lastgametype = gametype;
|
||||
gametype = READUINT8(*cp);
|
||||
gametype = READUINT16(*cp);
|
||||
G_SetGametype(gametype); // I fear putting that macro as an argument
|
||||
|
||||
if (gametype < 0 || gametype >= numgametypes)
|
||||
|
|
@ -4123,9 +4124,9 @@ static void Command_RestartLevel(void)
|
|||
D_MapChange(gamemap, gametype, encoremode, false, 0, false, false);
|
||||
}
|
||||
|
||||
static void Handle_MapQueueSend(UINT16 newmapnum, UINT8 newgametype, boolean newencoremode)
|
||||
static void Handle_MapQueueSend(UINT16 newmapnum, UINT16 newgametype, boolean newencoremode)
|
||||
{
|
||||
static char buf[1+1+2];
|
||||
static char buf[1+2+2];
|
||||
static char *buf_p = buf;
|
||||
|
||||
UINT8 flags = 0;
|
||||
|
|
@ -4140,7 +4141,7 @@ static void Handle_MapQueueSend(UINT16 newmapnum, UINT8 newgametype, boolean new
|
|||
flags |= 1;
|
||||
|
||||
WRITEUINT8(buf_p, flags);
|
||||
WRITEUINT8(buf_p, newgametype);
|
||||
WRITEUINT16(buf_p, newgametype);
|
||||
|
||||
if (client)
|
||||
{
|
||||
|
|
@ -4318,16 +4319,16 @@ static void Command_QueueMap_f(void)
|
|||
|
||||
static void Got_RequestMapQueuecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
UINT8 flags, setgametype;
|
||||
UINT8 flags;
|
||||
boolean setencore;
|
||||
UINT16 mapnumber;
|
||||
UINT16 mapnumber, setgametype;
|
||||
boolean doclear = false;
|
||||
|
||||
flags = READUINT8(*cp);
|
||||
|
||||
setencore = ((flags & 1) != 0);
|
||||
|
||||
setgametype = READUINT8(*cp);
|
||||
setgametype = READUINT16(*cp);
|
||||
|
||||
mapnumber = READUINT16(*cp);
|
||||
|
||||
|
|
@ -4364,15 +4365,16 @@ static void Got_RequestMapQueuecmd(UINT8 **cp, INT32 playernum)
|
|||
|
||||
static void Got_MapQueuecmd(UINT8 **cp, INT32 playernum)
|
||||
{
|
||||
UINT8 flags, setgametype, queueposition;
|
||||
UINT8 flags, queueposition;
|
||||
boolean setencore;
|
||||
boolean doclear = false;
|
||||
UINT16 setgametype;
|
||||
|
||||
flags = READUINT8(*cp);
|
||||
|
||||
setencore = ((flags & 1) != 0);
|
||||
|
||||
setgametype = READUINT8(*cp);
|
||||
setgametype = READUINT16(*cp);
|
||||
|
||||
queueposition = READUINT8(*cp);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ typedef enum
|
|||
struct roundentry_t
|
||||
{
|
||||
UINT16 mapnum; // Map number at this position
|
||||
UINT8 gametype; // Gametype we want to play this in
|
||||
UINT16 gametype; // Gametype we want to play this in
|
||||
boolean encore; // Whether this will be flipped
|
||||
boolean rankrestricted; // For grand prix progression
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue