Fix off-by-one error when setting justPlayed on a map header (plus debug code)
This is because although the map value per gametype is decreased by 4 (VOTE_NUM_LEVELS) to account for 4 vote selections, it doesn't account for the prevmap being one of those four levels, so we decrease by one to account for that also.
This commit is contained in:
parent
1f521d21da
commit
6892abcb8c
1 changed files with 67 additions and 1 deletions
68
src/g_game.c
68
src/g_game.c
|
|
@ -4787,6 +4787,71 @@ tryAgain:
|
||||||
|
|
||||||
void G_AddMapToBuffer(mapnum_t map)
|
void G_AddMapToBuffer(mapnum_t 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 (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.
|
||||||
|
|
@ -4801,7 +4866,8 @@ void G_AddMapToBuffer(mapnum_t map)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set our map's justPlayed value.
|
// Set our map's justPlayed value.
|
||||||
mapheaderinfo[map]->justPlayed = TOLMaps(gametype) - VOTEROWSADDSONE;
|
mapheaderinfo[map]->justPlayed = TOLMaps(gametype) - VOTEROWSADDSONE - 1;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#undef VOTEROWSADDSONE
|
#undef VOTEROWSADDSONE
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue