Implemented a call check between ui/play/data

This commit is contained in:
ZZYZX 2017-02-17 23:02:43 +02:00
commit 3056570ea9
2 changed files with 42 additions and 14 deletions

View file

@ -132,6 +132,14 @@ struct FScopeBarrier
}
}
// this modifies VARF_ flags and sets the side properly.
static int ChangeSideInFlags(int flags, int side)
{
flags &= ~(VARF_UI | VARF_Play);
flags |= FlagsFromSide(side);
return flags;
}
FScopeBarrier()
{
sidefrom = -1;
@ -203,7 +211,7 @@ struct FScopeBarrier
if (callable && (sidefrom != sideto) && !(flags2 & VARF_ReadOnly)) // readonly on methods is used for plain data stuff that can be called from ui/play context.
{
callable = false;
callerror.Format("Can't call %s field %s from %s context", StringFromSide(sideto), name, StringFromSide(sidefrom));
callerror.Format("Can't call %s function %s from %s context", StringFromSide(sideto), name, StringFromSide(sidefrom));
}
}
};