mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Pre-emptive fixes for custom gametypes
- Handle mismatched gametypes for client and server on voting screen - I_Error when running out of gametypes - Reduce gametype freeslots slightly to avoid colliding with VOTEMODIFIER_ENCORE
This commit is contained in:
parent
ab63be694a
commit
fbc3af2096
3 changed files with 21 additions and 3 deletions
|
|
@ -5313,6 +5313,24 @@ static void Got_SetupVotecmd(UINT8 **cp, INT32 playernum)
|
||||||
gt &= ~VOTEMODIFIER_ENCORE;
|
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++)
|
for (i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
tempvotelevels[i][0] = (UINT16)READUINT16(*cp);
|
tempvotelevels[i][0] = (UINT16)READUINT16(*cp);
|
||||||
|
|
|
||||||
|
|
@ -881,7 +881,7 @@ void readgametype(MYFILE *f, char *gtname)
|
||||||
// Ran out of gametype slots
|
// Ran out of gametype slots
|
||||||
if (gametypecount == NUMGAMETYPEFREESLOTS)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -454,7 +454,7 @@ extern mapheader_t** mapheaderinfo;
|
||||||
extern INT32 nummapheaders, mapallocsize;
|
extern INT32 nummapheaders, mapallocsize;
|
||||||
|
|
||||||
// Gametypes
|
// Gametypes
|
||||||
#define NUMGAMETYPEFREESLOTS 128
|
#define NUMGAMETYPEFREESLOTS (NUMGAMETYPES-GT_FIRSTFREESLOT)
|
||||||
|
|
||||||
enum GameType
|
enum GameType
|
||||||
{
|
{
|
||||||
|
|
@ -462,7 +462,7 @@ enum GameType
|
||||||
GT_BATTLE,
|
GT_BATTLE,
|
||||||
|
|
||||||
GT_FIRSTFREESLOT,
|
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
|
NUMGAMETYPES
|
||||||
};
|
};
|
||||||
// If you alter this list, update deh_tables.c, MISC_ChangeGameTypeMenu in m_menu.c, and Gametype_Names in g_game.c
|
// If you alter this list, update deh_tables.c, MISC_ChangeGameTypeMenu in m_menu.c, and Gametype_Names in g_game.c
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue