summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2016-06-13 17:34:18 +0000
committerfrosch <frosch@openttd.org>2016-06-13 17:34:18 +0000
commit2782993dd789d7bedab9f07b761221b0da7e80c0 (patch)
tree14ef7371e29618e372431c3ee02502e91b27ac8c
parent37e263e4fa40f883b6ddda3cfe4f1fbc0fee2632 (diff)
downloadopenttd-2782993dd789d7bedab9f07b761221b0da7e80c0.tar.xz
(svn r27600) -Fix: [NewGRF] shift-and-add-divide/modulo varadjusts use signed division/modulo.
-rw-r--r--src/newgrf_spritegroup.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp
index 624b4d547..c6fcd0a9e 100644
--- a/src/newgrf_spritegroup.cpp
+++ b/src/newgrf_spritegroup.cpp
@@ -204,8 +204,8 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, ScopeResolver
if (adjust->type != DSGA_TYPE_NONE) value += (S)adjust->add_val;
switch (adjust->type) {
- case DSGA_TYPE_DIV: value /= (S)adjust->divmod_val; break;
- case DSGA_TYPE_MOD: value %= (U)adjust->divmod_val; break;
+ 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_NONE: break;
}