mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-23 20:43:15 +00:00
Add "support" for user string variables in DECORATE
- This is "support" in the very most basic sense. You can declare them, but you can't actually do anything with them, since the decorate parser can't handle expressions when it's parsing string arguments. However, they seem to be getting properly initialized and destroyed, which is what this was added to test. If it doesn't look like too much trouble, I might try to turn them into something actually worth something.
This commit is contained in:
parent
7c8cff64e6
commit
c90a1c0c96
1 changed files with 8 additions and 3 deletions
|
@ -533,12 +533,17 @@ static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClassActor *cl
|
|||
|
||||
// Read the type and make sure it's acceptable.
|
||||
sc.MustGetAnyToken();
|
||||
if (sc.TokenType != TK_Int && sc.TokenType != TK_Float)
|
||||
switch (sc.TokenType)
|
||||
{
|
||||
sc.ScriptMessage("User variables must be of type 'int' or 'float'");
|
||||
case TK_Int: type = TypeSInt32; break;
|
||||
case TK_Float: type = TypeFloat64; break;
|
||||
case TK_String: type = TypeString; break;
|
||||
default:
|
||||
type = TypeError;
|
||||
sc.ScriptMessage("User variables must be of type 'int' or 'float' or 'string'");
|
||||
FScriptPosition::ErrorCounter++;
|
||||
break;
|
||||
}
|
||||
type = sc.TokenType == TK_Int ? (PType *)TypeSInt32 : (PType *)TypeFloat64;
|
||||
|
||||
sc.MustGetToken(TK_Identifier);
|
||||
// For now, restrict user variables to those that begin with "user_" to guarantee
|
||||
|
|
Loading…
Reference in a new issue