diff options
author | frosch <frosch@openttd.org> | 2018-03-11 13:18:13 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2018-03-11 13:18:13 +0000 |
commit | 7c406f0d9dc365960f07e20e690cc0bdf8682fd6 (patch) | |
tree | cb3b16b95d8f860fcdd9ec82c08fa3a21b9cf63e | |
parent | 4fc178aebd65bbdccead5122ae45e2bdcf752a4e (diff) | |
download | openttd-7c406f0d9dc365960f07e20e690cc0bdf8682fd6.tar.xz |
(svn r27983) -Codechange: Reduce complexity of VA2 add-div/mod adjustments
-rw-r--r-- | src/newgrf_spritegroup.cpp | 6 |
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; } |