summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2018-03-11 13:18:13 +0000
committerfrosch <frosch@openttd.org>2018-03-11 13:18:13 +0000
commit7c406f0d9dc365960f07e20e690cc0bdf8682fd6 (patch)
treecb3b16b95d8f860fcdd9ec82c08fa3a21b9cf63e
parent4fc178aebd65bbdccead5122ae45e2bdcf752a4e (diff)
downloadopenttd-7c406f0d9dc365960f07e20e690cc0bdf8682fd6.tar.xz
(svn r27983) -Codechange: Reduce complexity of VA2 add-div/mod adjustments
-rw-r--r--src/newgrf_spritegroup.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp
index 96ebdf093..5a53e3b6a 100644
--- a/src/newgrf_spritegroup.cpp
+++ b/src/newgrf_spritegroup.cpp
@@ -194,11 +194,9 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, ScopeResolver
value >>= adjust->shift_num;
value &= adjust->and_mask;
- if (adjust->type != DSGA_TYPE_NONE) value += (S)adjust->add_val;
-
switch (adjust->type) {
- case DSGA_TYPE_DIV: value = (S)value / (S)adjust->divmod_val; break;
- case DSGA_TYPE_MOD: value = (S)value % (S)adjust->divmod_val; break;
+ case DSGA_TYPE_DIV: value = ((S)value + (S)adjust->add_val) / (S)adjust->divmod_val; break;
+ case DSGA_TYPE_MOD: value = ((S)value + (S)adjust->add_val) % (S)adjust->divmod_val; break;
case DSGA_TYPE_NONE: break;
}