I just found a strange bug with a particular arrangement of operations and an inline if:
void advance(bool full) {
nextThink = gameTime + ( (full ? 10.0 : 1.0) * 30.0 );
}
Expected: nextThink = 300 or 30, depending on the argument.
Result: 900. (tested with different values, always the square of the last value)
The function is a method in a class.
nextThink is a member of that class.
gameTime is a global property accessor. Removing this operation eliminates the bug.
Similarly:
void advance(bool full) {
nextThink = gameTime + ( 30.0 * (full ? 10.0 : 1.0) );
}
Expected: nextThink = 300 or 30, depending on the argument.
Result: 100 (full was true in this case, so it used the result of the inline if twice)