summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-04-29 07:26:57 +0000
committerpeter1138 <peter1138@openttd.org>2006-04-29 07:26:57 +0000
commit19e3eb6f3cc400f75f5cd62b8a49e9f2a7e1e6d7 (patch)
treedd4f0060bbde45165f5e64016fbcc4f49f53a846
parent7ab8b20faf44696e276d3a15836df08bf21c7d3d (diff)
downloadopenttd-19e3eb6f3cc400f75f5cd62b8a49e9f2a7e1e6d7.tar.xz
(svn r4616) - NewGRF: when evaluating a variable adjustment, give our value the correct type after rather than before it has been adjusted.
-rw-r--r--newgrf_spritegroup.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/newgrf_spritegroup.c b/newgrf_spritegroup.c
index cac7bbb20..d389c07ad 100644
--- a/newgrf_spritegroup.c
+++ b/newgrf_spritegroup.c
@@ -112,7 +112,7 @@ static inline uint32 GetVariable(const ResolverObject *object, byte variable, by
/* Evaluate an adjustment for a variable of the given size. This is a bit of
* an unwieldy macro, but it saves triplicating the code. */
#define BUILD_EVAL_ADJUST(size, usize) \
-static inline size EvalAdjust_ ## size(const DeterministicSpriteGroupAdjust *adjust, size last_value, size value) \
+static inline size EvalAdjust_ ## size(const DeterministicSpriteGroupAdjust *adjust, size last_value, uint value) \
{ \
value >>= adjust->shift_num; \
value &= adjust->and_mask; \
@@ -125,6 +125,9 @@ static inline size EvalAdjust_ ## size(const DeterministicSpriteGroupAdjust *adj
case DSGA_TYPE_NONE: break; \
} \
\
+ /* Get our value to the correct range */ \
+ value = (size)value; \
+\
switch (adjust->operation) { \
case DSGA_OP_ADD: return last_value + value; \
case DSGA_OP_SUB: return last_value - value; \