Merge branch 'master' into floatcvt

# Conflicts:
#	src/dobjtype.cpp
#	src/dobjtype.h
This commit is contained in:
Christoph Oelckers 2016-03-30 09:47:25 +02:00
commit 0eb35d6c6e
6 changed files with 176 additions and 40 deletions

View file

@ -523,14 +523,14 @@ static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClassActor *cl
sc.ScriptError("Native classes may not have user variables");
}
// Read the type and make sure it's int.
// Read the type and make sure it's acceptable.
sc.MustGetAnyToken();
if (sc.TokenType != TK_Int)
if (sc.TokenType != TK_Int && sc.TokenType != TK_Float)
{
sc.ScriptMessage("User variables must be of type int");
sc.ScriptMessage("User variables must be of type 'int' or 'float'");
FScriptPosition::ErrorCounter++;
}
type = TypeSInt32;
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
@ -577,7 +577,7 @@ static void ParseUserVariable (FScanner &sc, PSymbolTable *symt, PClassActor *cl
sc.MustGetToken(';');
PField *sym = new PField(symname, type, 0);
sym->Offset = cls->Extend(sizeof(int) * maxelems);
sym->Offset = cls->Extend(type);
if (symt->AddSymbol(sym) == NULL)
{
delete sym;