-protected critical portal data from getting written to by user code.

This data is game critical and may only be altered by code that knows what is allowed and what not. It must never be altered by any user code ever.
However, since the SkyViewpoint actors need to set up some relations between themselves and the default sky portals the previously purely internal 'internal' flag has been exported as a new keyword.
This commit is contained in:
Christoph Oelckers 2018-04-15 12:12:29 +02:00
parent 4ea16acef5
commit cf8447d19c
9 changed files with 10 additions and 4 deletions

View file

@ -209,6 +209,7 @@ std2:
'version' { RET(ParseVersion >= MakeVersion(2, 4, 0)? TK_Version : TK_Identifier); }
'action' { RET(ParseVersion >= MakeVersion(1, 0, 0)? TK_Action : TK_Identifier); }
'readonly' { RET(ParseVersion >= MakeVersion(1, 0, 0)? TK_ReadOnly : TK_Identifier); }
'internal' { RET(ParseVersion >= MakeVersion(3, 4, 0)? TK_Internal : TK_Identifier); }
'let' { RET(ParseVersion >= MakeVersion(1, 0, 0)? TK_Let : TK_Identifier); }
/* Actor state options */

View file

@ -138,6 +138,7 @@ xx(TK_Meta, "'meta'")
xx(TK_Deprecated, "'deprecated'")
xx(TK_Version, "'version'")
xx(TK_ReadOnly, "'readonly'")
xx(TK_Internal, "'internal'")
xx(TK_CanRaise, "'canraise'")
xx(TK_Fast, "'fast'")

View file

@ -1120,6 +1120,7 @@ decl_flag(X) ::= FINAL(T). { X.Int = ZCC_Final; X.SourceLoc = T.SourceLoc; }
decl_flag(X) ::= META(T). { X.Int = ZCC_Meta; X.SourceLoc = T.SourceLoc; }
decl_flag(X) ::= TRANSIENT(T). { X.Int = ZCC_Transient; X.SourceLoc = T.SourceLoc; }
decl_flag(X) ::= READONLY(T). { X.Int = ZCC_ReadOnly; X.SourceLoc = T.SourceLoc; }
decl_flag(X) ::= INTERNAL(T). { X.Int = ZCC_Internal; X.SourceLoc = T.SourceLoc; }
decl_flag(X) ::= VIRTUAL(T). { X.Int = ZCC_Virtual; X.SourceLoc = T.SourceLoc; }
decl_flag(X) ::= OVERRIDE(T). { X.Int = ZCC_Override; X.SourceLoc = T.SourceLoc; }
decl_flag(X) ::= VARARG(T). { X.Int = ZCC_VarArg; X.SourceLoc = T.SourceLoc; }

View file

@ -1241,6 +1241,7 @@ bool ZCCCompiler::CompileFields(PContainerType *type, TArray<ZCC_VarDeclarator *
if (field->Flags & ZCC_Protected) varflags |= VARF_Protected;
if (field->Flags & ZCC_Deprecated) varflags |= VARF_Deprecated;
if (field->Flags & ZCC_ReadOnly) varflags |= VARF_ReadOnly;
if (field->Flags & ZCC_Internal) varflags |= VARF_InternalAccess;
if (field->Flags & ZCC_Transient) varflags |= VARF_Transient;
if (mVersion >= MakeVersion(2, 4, 0))
{
@ -2327,7 +2328,7 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
} while (t != f->Type);
}
int notallowed = ZCC_Latent | ZCC_Meta | ZCC_ReadOnly | ZCC_Abstract;
int notallowed = ZCC_Latent | ZCC_Meta | ZCC_ReadOnly | ZCC_Abstract | ZCC_Internal;
if (f->Flags & notallowed)
{

View file

@ -149,6 +149,7 @@ static void InitTokenMap()
TOKENDEF (TK_Deprecated, ZCC_DEPRECATED);
TOKENDEF (TK_Version, ZCC_VERSION);
TOKENDEF (TK_ReadOnly, ZCC_READONLY);
TOKENDEF (TK_Internal, ZCC_INTERNAL);
TOKENDEF ('{', ZCC_LBRACE);
TOKENDEF ('}', ZCC_RBRACE);
TOKENDEF (TK_Struct, ZCC_STRUCT);

View file

@ -63,6 +63,7 @@ enum
ZCC_ClearScope = 1 << 19,
ZCC_VirtualScope = 1 << 20,
ZCC_Version = 1 << 21,
ZCC_Internal = 1 << 22,
};
// Function parameter modifiers

View file

@ -57,7 +57,7 @@ const char *GetVersionString();
#define RC_PRODUCTVERSION2 VERSIONSTR
// These are for content versioning. The current state is '3.3'.
#define VER_MAJOR 3
#define VER_MINOR 3
#define VER_MINOR 4
#define VER_REVISION 0
// Version identifier for network games.

View file

@ -1,4 +1,4 @@
version "3.3"
version "3.4"
#include "zscript/base.txt"
#include "zscript/sounddata.txt"
#include "zscript/mapdata.txt"

View file

@ -334,7 +334,7 @@ struct Sector native play
native SectorAction SecActTarget;
native uint Portals[2];
native internal uint Portals[2];
native readonly int PortalGroup;
native readonly int sectornum;