diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a8241c14f..bcab54eef 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -5313,6 +5313,24 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum) gt &= ~VOTEMODIFIER_ENCORE; } + if ((gt & ~VOTEMODIFIER_ENCORE) >= gametypecount) + { + gt &= ~VOTEMODIFIER_ENCORE; + if (server) + I_Error("Got_SetupVotecmd: Internal gametype ID %d not found (gametypecount = %d)", gt, gametypecount); + CONS_Alert(CONS_WARNING, M_GetText("Vote setup with bad gametype ID %d received from %s\n"), gt, player_names[playernum]); + return; + } + + if ((secondgt & ~VOTEMODIFIER_ENCORE) >= gametypecount) + { + secondgt &= ~VOTEMODIFIER_ENCORE; + if (server) + I_Error("Got_SetupVotecmd: Internal second gametype ID %d not found (gametypecount = %d)", secondgt, gametypecount); + CONS_Alert(CONS_WARNING, M_GetText("Vote setup with bad second gametype ID %d received from %s\n"), secondgt, player_names[playernum]); + return; + } + for (i = 0; i < 4; i++) { tempvotelevels[i][0] = (UINT16)READUINT16(*cp); diff --git a/src/deh_soc.c b/src/deh_soc.c index 1d7b94214..9d39652f0 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -881,7 +881,7 @@ void readgametype(MYFILE *f, char *gtname) // Ran out of gametype slots if (gametypecount == NUMGAMETYPEFREESLOTS) { - CONS_Alert(CONS_WARNING, "Ran out of free gametype slots!\n"); + I_Error("Out of Gametype Freeslots while allocating \"%s\"\nLoad less addons to fix this.", gtname); return; } diff --git a/src/doomstat.h b/src/doomstat.h index d5559361b..5eae8208f 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -454,7 +454,7 @@ extern mapheader_t** mapheaderinfo; extern INT32 nummapheaders, mapallocsize; // Gametypes -#define NUMGAMETYPEFREESLOTS 128 +#define NUMGAMETYPEFREESLOTS (NUMGAMETYPES-GT_FIRSTFREESLOT) enum GameType { @@ -462,7 +462,7 @@ enum GameType GT_BATTLE, GT_FIRSTFREESLOT, - GT_LASTFREESLOT = GT_FIRSTFREESLOT + NUMGAMETYPEFREESLOTS - 1, + GT_LASTFREESLOT = 127, // Previously (GT_FIRSTFREESLOT + NUMGAMETYPEFREESLOTS - 1) - it would be necessary to rewrite VOTEMODIFIER_ENCORE to go higher than this. NUMGAMETYPES }; // If you alter this list, update deh_tables.c, MISC_ChangeGameTypeMenu in m_menu.c, and Gametype_Names in g_game.c