diff --git a/src/dobjtype.h b/src/dobjtype.h index dad47d44c..56ae1b6de 100644 --- a/src/dobjtype.h +++ b/src/dobjtype.h @@ -38,7 +38,7 @@ class PSymbolConst : public PSymbol { DECLARE_CLASS(PSymbolConst, PSymbol); public: - int ValueType; + class PType *ValueType; union { int Value; diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index d5fd9b0d2..1f5d48ab5 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -297,17 +297,16 @@ FxExpression *FxConstant::MakeConstant(PSymbol *sym, const FScriptPosition &pos) PSymbolConst *csym = dyn_cast(sym); if (csym != NULL) { - switch(csym->ValueType) + if (csym->ValueType->IsA(RUNTIME_CLASS(PInt))) { - case VAL_Int: x = new FxConstant(csym->Value, pos); - break; - - case VAL_Float: + } + else if (csym->ValueType->IsA(RUNTIME_CLASS(PFloat))) + { x = new FxConstant(csym->Float, pos); - break; - - default: + } + else + { pos.Message(MSG_ERROR, "Invalid constant '%s'\n", csym->SymbolName.GetChars()); return NULL; } diff --git a/src/thingdef/thingdef_parse.cpp b/src/thingdef/thingdef_parse.cpp index 55d43b535..db8238d1c 100644 --- a/src/thingdef/thingdef_parse.cpp +++ b/src/thingdef/thingdef_parse.cpp @@ -205,12 +205,12 @@ static void ParseConstant (FScanner &sc, PSymbolTable *symt, PClassActor *cls) PSymbolConst *sym = new PSymbolConst(symname); if (type == TK_Int) { - sym->ValueType = VAL_Int; + sym->ValueType = TypeSInt32; sym->Value = val.GetInt(); } else { - sym->ValueType = VAL_Float; + sym->ValueType = TypeFloat64; sym->Float = val.GetFloat(); } if (symt->AddSymbol (sym) == NULL) @@ -261,7 +261,7 @@ static void ParseEnum (FScanner &sc, PSymbolTable *symt, PClassActor *cls) delete expr; } PSymbolConst *sym = new PSymbolConst(symname); - sym->ValueType = VAL_Int; + sym->ValueType = TypeSInt32; sym->Value = currvalue; if (symt->AddSymbol (sym) == NULL) {