Made unsafe execution context check for CVARs more strict

This prevents changing of non-mod CVARs from unsafe context for various code paths including set and toggle CCMDs
This commit is contained in:
alexey.lysiuk 2018-01-29 15:20:35 +02:00
commit 1e9fdca755
3 changed files with 8 additions and 9 deletions

View file

@ -53,6 +53,7 @@
#include "colormatcher.h"
#include "menu/menu.h"
#include "vm.h"
#include "v_text.h"
struct FLatchedValue
{
@ -156,6 +157,11 @@ void FBaseCVar::SetGenericRep (UCVarValue value, ECVarType type)
{
return;
}
else if (UnsafeExecutionContext && !(GetFlags() & CVAR_MOD))
{
Printf(TEXTCOLOR_RED "Cannot set console variable" TEXTCOLOR_GOLD " %s " TEXTCOLOR_RED "from unsafe command\n", GetName());
return;
}
else if ((Flags & CVAR_LATCH) && gamestate != GS_FULLCONSOLE && gamestate != GS_STARTUP)
{
FLatchedValue latch;