BGE patch 18368: Modulus (ie %) expression controller in BGE. Implement a cache for the expression for better performance.

This commit is contained in:
2009-03-11 22:11:52 +00:00
parent 0ac3e70160
commit a37cec2802
12 changed files with 68 additions and 15 deletions

View File

@@ -125,6 +125,9 @@ this object
case VALUE_INT_TYPE:
{
switch (op) {
case VALUE_MOD_OPERATOR:
ret = new CIntValue (((CIntValue *) val)->GetInt() % m_int);
break;
case VALUE_ADD_OPERATOR:
ret = new CIntValue (((CIntValue *) val)->GetInt() + m_int);
break;
@@ -181,6 +184,9 @@ this object
case VALUE_FLOAT_TYPE:
{
switch (op) {
case VALUE_MOD_OPERATOR:
ret = new CFloatValue(fmod(((CFloatValue *) val)->GetFloat(), m_int));
break;
case VALUE_ADD_OPERATOR:
ret = new CFloatValue (((CFloatValue *) val)->GetFloat() + m_int);
break;