Fix invalid numlaps value being written when set to map default

This commit is contained in:
fickleheart 2019-01-27 17:58:13 -06:00
parent 3a467889ae
commit 314b2769a9
1 changed files with 13 additions and 1 deletions

View File

@ -1372,7 +1372,19 @@ void CV_SaveNetVars(UINT8 **p, boolean demorecording)
// UGLY HACK: Save proper lap count in net replays
if (demorecording && cvar->netid == cv_numlaps.netid)
{
WRITESTRING(*p, cv_basenumlaps.string);
if (cv_basenumlaps.value &&
(!(mapheaderinfo[gamemap - 1]->levelflags & LF_SECTIONRACE)
|| (mapheaderinfo[gamemap - 1]->numlaps > cv_basenumlaps.value))
)
{
WRITESTRING(*p, cv_basenumlaps.string);
}
else
{
char buf[9];
sprintf(buf, "%d", mapheaderinfo[gamemap - 1]->numlaps);
WRITESTRING(*p, buf);
}
}
else
{