- fixed writeback of hud_size CVAR

G_ChangeHudLayout must ensure that the written value is ok, otherwise the auto validation in the CVAR can screw things up.
This commit is contained in:
Christoph Oelckers 2019-12-05 00:54:55 +01:00
parent 628bd9efc6
commit 6914408453
1 changed files with 2 additions and 2 deletions

View File

@ -220,7 +220,7 @@ bool G_ChangeHudLayout(int direction)
{
int layout = hud_size - 1;
while (!gi->validate_hud(layout) && layout >= 0) layout--;
if (layout >= 0)
if (layout >= 0 && layout < hud_size && gi->validate_hud(layout))
{
hud_size = layout;
return true;
@ -230,7 +230,7 @@ bool G_ChangeHudLayout(int direction)
{
int layout = hud_size + 1;
while (!gi->validate_hud(layout) && layout <= 11) layout++;
if (layout <= 11)
if (layout <= 11 && layout > hud_size && gi->validate_hud(layout))
{
hud_size = layout;
return true;