NUMGAMETYPES vs gametypecount

This commit is contained in:
Jaime Passos 2019-12-18 12:30:01 -03:00
parent 86ac94817a
commit 7807424633
7 changed files with 16 additions and 16 deletions

View File

@ -2114,7 +2114,7 @@ static void CL_ConnectToServer(boolean viams)
UINT8 num = serverlist[i].info.gametype;
const char *gametypestr = NULL;
CONS_Printf(M_GetText("Connecting to: %s\n"), serverlist[i].info.servername);
if (num < NUMGAMETYPES)
if (num < gametypecount)
gametypestr = Gametype_Names[num];
if (gametypestr)
CONS_Printf(M_GetText("Gametype: %s\n"), gametypestr);

View File

@ -1409,7 +1409,7 @@ void D_SRB2Main(void)
if (newgametype == -1) // reached end of the list with no match
{
j = atoi(sgametype); // assume they gave us a gametype number, which is okay too
if (j >= 0 && j < NUMGAMETYPES)
if (j >= 0 && j < gametypecount)
newgametype = (INT16)j;
}

View File

@ -383,7 +383,7 @@ boolean timedemo_quit;
INT16 gametype = GT_COOP;
UINT32 gametyperules = 0;
INT16 numgametypes = (GT_CTF + 1);
INT16 gametypecount = (GT_CTF + 1);
boolean splitscreen = false;
boolean circuitmap = false;
@ -1943,7 +1943,7 @@ static void Command_Map_f(void)
if (isdigit(gametypename[0]))
{
d = atoi(gametypename);
if (d >= 0 && d < NUMGAMETYPES)
if (d >= 0 && d < gametypecount)
newgametype = d;
else
{
@ -1951,7 +1951,7 @@ static void Command_Map_f(void)
"Gametype number %d is out of range. Use a number between"
" 0 and %d inclusive. ...Or just use the name. :v\n",
d,
NUMGAMETYPES-1);
gametypecount-1);
Z_Free(realmapname);
Z_Free(mapname);
return;
@ -2072,7 +2072,7 @@ static void Got_Mapcmd(UINT8 **cp, INT32 playernum)
gametype = READUINT8(*cp);
G_SetGametype(gametype); // I fear putting that macro as an argument
if (gametype < 0 || gametype >= NUMGAMETYPES)
if (gametype < 0 || gametype >= gametypecount)
gametype = lastgametype;
else if (gametype != lastgametype)
D_GameTypeChanged(lastgametype); // emulate consvar_t behavior for gametype
@ -3624,7 +3624,7 @@ static void Command_ShowGametype_f(void)
}
// get name string for current gametype
if (gametype >= 0 && gametype < NUMGAMETYPES)
if (gametype >= 0 && gametype < gametypecount)
gametypestr = Gametype_Names[gametype];
if (gametypestr)
@ -3891,9 +3891,9 @@ void D_GameTypeChanged(INT32 lastgametype)
{
const char *oldgt = NULL, *newgt = NULL;
if (lastgametype >= 0 && lastgametype < NUMGAMETYPES)
if (lastgametype >= 0 && lastgametype < gametypecount)
oldgt = Gametype_Names[lastgametype];
if (gametype >= 0 && lastgametype < NUMGAMETYPES)
if (gametype >= 0 && lastgametype < gametypecount)
newgt = Gametype_Names[gametype];
if (oldgt && newgt)

View File

@ -85,7 +85,7 @@ extern boolean multiplayer;
extern INT16 gametype;
extern UINT32 gametyperules;
extern INT16 numgametypes;
extern INT16 gametypecount;
extern boolean splitscreen;
extern boolean circuitmap; // Does this level have 'circuit mode'?

View File

@ -3102,15 +3102,15 @@ void G_SetGametype(INT16 gtype)
INT16 G_NewGametype(UINT32 rules)
{
INT32 i;
INT16 newgtype = numgametypes;
numgametypes++;
INT16 newgtype = gametypecount;
gametypecount++;
// Set gametype rules.
gametypedefaultrules[newgtype] = numgametypes;
gametypedefaultrules[newgtype] = gametypecount;
Gametype_Names[newgtype] = "???";
// Update gametype_cons_t accordingly.
for (i = 0; i < numgametypes; i++)
for (i = 0; i < gametypecount; i++)
{
gametype_cons_t[i].value = i;
gametype_cons_t[i].strvalue = Gametype_Names[i];

View File

@ -2066,7 +2066,7 @@ static void HU_drawGametype(void)
{
const char *strvalue = NULL;
if (gametype < 0 || gametype >= NUMGAMETYPES)
if (gametype < 0 || gametype >= gametypecount)
return; // not a valid gametype???
strvalue = Gametype_Names[gametype];

View File

@ -9932,7 +9932,7 @@ static void M_DrawConnectMenu(void)
va("Ping: %u", (UINT32)LONG(serverlist[slindex].info.time)));
gt = "Unknown";
if (serverlist[slindex].info.gametype < NUMGAMETYPES)
if (serverlist[slindex].info.gametype < gametypecount)
gt = Gametype_Names[serverlist[slindex].info.gametype];
V_DrawSmallString(currentMenu->x+46,S_LINEY(i)+8, globalflags,