# HG changeset patch # User Teemu Piippo # Date 1391513902 -7200 # Node ID 4db95b92c29a62af9213cafd839defb2b385128b # Parent 8915ee6a277d46c89ea18ee23bedb4017285a4b5 - fixed verification with unary operators diff -r 8915ee6a277d -r 4db95b92c29a src/Expression.cc --- a/src/Expression.cc Tue Feb 04 04:35:49 2014 +0200 +++ b/src/Expression.cc Tue Feb 04 13:38:22 2014 +0200 @@ -235,6 +235,14 @@ // void Expression::TryVerifyValue (bool* verified, SymbolList::Iterator it) { + // If it's an unary operator we skip to its value. The actual operator will + // be verified separately. + if ((*it)->GetType() == eOperatorSymbol && + gOperators[static_cast (*it)->GetID()].numoperands == 1) + { + ++it; + } + int i = it - mSymbols.begin(); // Ensure it's an actual value @@ -414,10 +422,12 @@ ExpressionValue* newval = new ExpressionValue (mType); if (isconstexpr == false) + { + // This is not a constant expression so we'll have to use databuffers + // to convey the expression to bytecode. Actual value cannot be evaluated + // until Zandronum processes it at run-time. newval->SetBuffer (new DataBuffer); - if (isconstexpr == false) - { if (op->GetID() == opTernary) { // There isn't a dataheader for ternary operator. Instead, we use dhIfNotGoto