diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-03-12 01:11:52 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-03-12 01:11:52 +0300 |
commit | a37cec2802d96306426f41c64f6ed69ab3680355 (patch) | |
tree | d0ad9ba1a8fb64072a6427e82b0fc4aa2a153d83 /source/gameengine/Expressions/InputParser.cpp | |
parent | 0ac3e7016048a7e66285b3539c6e86cf83a4cb06 (diff) |
BGE patch 18368: Modulus (ie %) expression controller in BGE. Implement a cache for the expression for better performance.
Diffstat (limited to 'source/gameengine/Expressions/InputParser.cpp')
-rw-r--r-- | source/gameengine/Expressions/InputParser.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/gameengine/Expressions/InputParser.cpp b/source/gameengine/Expressions/InputParser.cpp index e016fb8d007..94663c4a365 100644 --- a/source/gameengine/Expressions/InputParser.cpp +++ b/source/gameengine/Expressions/InputParser.cpp @@ -175,6 +175,9 @@ void CParser::NextSym() case ',': sym = commasym; NextCh(); break; + case '%' : + sym = opsym; opkind = OPmodulus; NextCh(); + break; case '+' : sym = opsym; opkind = OPplus; NextCh(); break; @@ -370,6 +373,7 @@ int CParser::Priority(int optorkind) { case OPunequal: return 3; case OPplus: case OPminus: return 4; + case OPmodulus: case OPtimes: case OPdivide: return 5; } @@ -390,6 +394,7 @@ CExpression *CParser::Ex(int i) { NextSym(); e2 = Ex(i + 1); switch(opkind2) { + case OPmodulus: e1 = new COperator2Expr(VALUE_MOD_OPERATOR,e1, e2); break; case OPplus: e1 = new COperator2Expr(VALUE_ADD_OPERATOR,e1, e2); break; case OPminus: e1 = new COperator2Expr(VALUE_SUB_OPERATOR,e1, e2); break; case OPtimes: e1 = new COperator2Expr(VALUE_MUL_OPERATOR,e1, e2); break; |