1
0
Fork 0

(svn r4784) - NewGRF: shuffle the mix of signed / unsigned types when dealing with var adjusts. Fixes issues with some station layouts.

release/0.5
peter1138 2006-05-08 17:47:35 +00:00
parent 288ffe7f50
commit 8fa9ff068f
1 changed files with 3 additions and 3 deletions

View File

@ -99,7 +99,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 /* Evaluate an adjustment for a variable of the given size. This is a bit of
* an unwieldy macro, but it saves triplicating the code. */ * an unwieldy macro, but it saves triplicating the code. */
#define BUILD_EVAL_ADJUST(size, usize) \ #define BUILD_EVAL_ADJUST(size, usize) \
static inline size EvalAdjust_ ## size(const DeterministicSpriteGroupAdjust *adjust, size last_value, uint value) \ static inline usize EvalAdjust_ ## size(const DeterministicSpriteGroupAdjust *adjust, usize last_value, int32 value) \
{ \ { \
value >>= adjust->shift_num; \ value >>= adjust->shift_num; \
value &= adjust->and_mask; \ value &= adjust->and_mask; \
@ -108,12 +108,12 @@ static inline size EvalAdjust_ ## size(const DeterministicSpriteGroupAdjust *adj
\ \
switch (adjust->type) { \ switch (adjust->type) { \
case DSGA_TYPE_DIV: value /= (size)adjust->divmod_val; break; \ case DSGA_TYPE_DIV: value /= (size)adjust->divmod_val; break; \
case DSGA_TYPE_MOD: value %= (size)adjust->divmod_val; break; \ case DSGA_TYPE_MOD: value %= (usize)adjust->divmod_val; break; \
case DSGA_TYPE_NONE: break; \ case DSGA_TYPE_NONE: break; \
} \ } \
\ \
/* Get our value to the correct range */ \ /* Get our value to the correct range */ \
value = (size)value; \ value = (usize)value; \
\ \
switch (adjust->operation) { \ switch (adjust->operation) { \
case DSGA_OP_ADD: return last_value + value; \ case DSGA_OP_ADD: return last_value + value; \