(svn r4616) - NewGRF: when evaluating a variable adjustment, give our value the correct type after rather than before it has been adjusted.
--- a/newgrf_spritegroup.c Fri Apr 28 21:58:16 2006 +0000
+++ b/newgrf_spritegroup.c Sat Apr 29 07:26:57 2006 +0000
@@ -112,7 +112,7 @@
/* 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 @@
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; \