mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Fix map vote dementia
This commit is contained in:
parent
2270813eee
commit
3425727ca6
2 changed files with 94 additions and 1 deletions
|
|
@ -2729,6 +2729,19 @@ void CL_RemovePlayer(INT32 playernum, kickreason_t reason)
|
||||||
|
|
||||||
K_CheckBumpers();
|
K_CheckBumpers();
|
||||||
P_CheckRacers();
|
P_CheckRacers();
|
||||||
|
|
||||||
|
// Reset map headers' justPlayed and anger records
|
||||||
|
// when there are no players in a dedicated server.
|
||||||
|
// Otherwise maps get angry at newly-joined players
|
||||||
|
// that don't deserve it.
|
||||||
|
if (dedicated && D_NumPlayers() == 0)
|
||||||
|
{
|
||||||
|
for (INT32 i = 0; i < nummapheaders; i++)
|
||||||
|
{
|
||||||
|
mapheaderinfo[i]->justPlayed = 0;
|
||||||
|
mapheaderinfo[i]->anger = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_Reset(void)
|
void CL_Reset(void)
|
||||||
|
|
|
||||||
82
src/g_game.c
82
src/g_game.c
|
|
@ -4064,12 +4064,91 @@ UINT16 G_RandMap(UINT32 tolflags, UINT16 pprevmap, boolean ignoreBuffers, boolea
|
||||||
|
|
||||||
void G_AddMapToBuffer(UINT16 map)
|
void G_AddMapToBuffer(UINT16 map)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
|
// DEBUG: make nearly everything but four race levels full justPlayed
|
||||||
|
// to look into what happens when a dedicated runs for seven million years.
|
||||||
|
INT32 justplayedvalue = TOLMaps(gametype) - VOTE_NUM_LEVELS;
|
||||||
|
UINT32 tolflag = G_TOLFlag(gametype);
|
||||||
|
|
||||||
|
// Find all the maps that are ok
|
||||||
|
INT32 i;
|
||||||
|
for (i = 0; i < nummapheaders; i++)
|
||||||
|
{
|
||||||
|
if (mapheaderinfo[i] == NULL)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapheaderinfo[i]->lumpnum == LUMPERROR)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((mapheaderinfo[i]->typeoflevel & tolflag) == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mapheaderinfo[i]->menuflags & LF2_HIDEINMENU)
|
||||||
|
{
|
||||||
|
// Don't include hidden
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only care about restrictions if the host is a listen server.
|
||||||
|
if (!dedicated)
|
||||||
|
{
|
||||||
|
if (!(mapheaderinfo[i]->menuflags & LF2_NOVISITNEEDED)
|
||||||
|
&& !(mapheaderinfo[i]->records.mapvisited & MV_VISITED)
|
||||||
|
&& !(
|
||||||
|
mapheaderinfo[i]->cup
|
||||||
|
&& mapheaderinfo[i]->cup->cachedlevels[0] == i
|
||||||
|
))
|
||||||
|
{
|
||||||
|
// Not visited OR head of cup
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((mapheaderinfo[i]->menuflags & LF2_FINISHNEEDED)
|
||||||
|
&& !(mapheaderinfo[i]->records.mapvisited & MV_BEATEN))
|
||||||
|
{
|
||||||
|
// Not completed
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (M_MapLocked(i + 1) == true)
|
||||||
|
{
|
||||||
|
// We haven't earned this one.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
mapheaderinfo[i]->justPlayed = justplayedvalue;
|
||||||
|
justplayedvalue -= 1;
|
||||||
|
if (justplayedvalue <= 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (dedicated && D_NumPlayers() == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const size_t upperJustPlayedLimit = TOLMaps(gametype) - VOTE_NUM_LEVELS - 1;
|
||||||
|
|
||||||
if (mapheaderinfo[map]->justPlayed == 0) // Started playing a new map.
|
if (mapheaderinfo[map]->justPlayed == 0) // Started playing a new map.
|
||||||
{
|
{
|
||||||
// Decrement every maps' justPlayed value.
|
// Decrement every maps' justPlayed value.
|
||||||
INT32 i;
|
INT32 i;
|
||||||
for (i = 0; i < nummapheaders; i++)
|
for (i = 0; i < nummapheaders; i++)
|
||||||
{
|
{
|
||||||
|
// If the map's justPlayed value is higher
|
||||||
|
// than what it should be, clamp it.
|
||||||
|
// (Usually a result of SOC files
|
||||||
|
// manipulating which levels are hidden.)
|
||||||
|
if (mapheaderinfo[i]->justPlayed > upperJustPlayedLimit)
|
||||||
|
{
|
||||||
|
mapheaderinfo[i]->justPlayed = upperJustPlayedLimit;
|
||||||
|
}
|
||||||
|
|
||||||
if (mapheaderinfo[i]->justPlayed > 0)
|
if (mapheaderinfo[i]->justPlayed > 0)
|
||||||
{
|
{
|
||||||
mapheaderinfo[i]->justPlayed--;
|
mapheaderinfo[i]->justPlayed--;
|
||||||
|
|
@ -4078,8 +4157,9 @@ void G_AddMapToBuffer(UINT16 map)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set our map's justPlayed value.
|
// Set our map's justPlayed value.
|
||||||
mapheaderinfo[map]->justPlayed = TOLMaps(gametype) - VOTE_NUM_LEVELS;
|
mapheaderinfo[map]->justPlayed = upperJustPlayedLimit;
|
||||||
mapheaderinfo[map]->anger = 0; // Reset voting anger now that we're playing it
|
mapheaderinfo[map]->anger = 0; // Reset voting anger now that we're playing it
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue