From 2782993dd789d7bedab9f07b761221b0da7e80c0 Mon Sep 17 00:00:00 2001 From: frosch Date: Mon, 13 Jun 2016 17:34:18 +0000 Subject: (svn r27600) -Fix: [NewGRF] shift-and-add-divide/modulo varadjusts use signed division/modulo. --- src/newgrf_spritegroup.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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; } -- cgit v1.2.3-70-g09d2