diff options
author | frosch <frosch@openttd.org> | 2010-03-21 11:05:39 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-03-21 11:05:39 +0000 |
commit | c049bf3f388438c9901981b1943b35fc3add3e4d (patch) | |
tree | 2bd583c61b01cecbd8ad64c38b68bd16767904a2 /src/newgrf_spritegroup.cpp | |
parent | b7b01bb9c703acdf93c36e7212e959b399442d93 (diff) | |
download | openttd-c049bf3f388438c9901981b1943b35fc3add3e4d.tar.xz |
(svn r19497) -Fix: [NewGRF] Bytes and words get sign-extended for temporary/persistent storage. (Spotted by yexo)
Diffstat (limited to 'src/newgrf_spritegroup.cpp')
-rw-r--r-- | src/newgrf_spritegroup.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index 993a75102..19b73c63c 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -42,7 +42,7 @@ TileLayoutSpriteGroup::~TileLayoutSpriteGroup() free(this->dts); } -TemporaryStorageArray<uint32, 0x110> _temp_store; +TemporaryStorageArray<int32, 0x110> _temp_store; static inline uint32 GetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) @@ -118,9 +118,9 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, ResolverObjec case DSGA_OP_AND: return last_value & value; case DSGA_OP_OR: return last_value | value; case DSGA_OP_XOR: return last_value ^ value; - case DSGA_OP_STO: _temp_store.Store(value, last_value); return last_value; + case DSGA_OP_STO: _temp_store.Store((U)value, (S)last_value); return last_value; case DSGA_OP_RST: return value; - case DSGA_OP_STOP: if (object->psa != NULL) object->psa->Store(value, last_value); return last_value; + case DSGA_OP_STOP: if (object->psa != NULL) object->psa->Store((U)value, (S)last_value); return last_value; case DSGA_OP_ROR: return RotateRight(last_value, value); case DSGA_OP_SCMP: return ((S)last_value == (S)value) ? 1 : ((S)last_value < (S)value ? 0 : 2); case DSGA_OP_UCMP: return ((U)last_value == (U)value) ? 1 : ((U)last_value < (U)value ? 0 : 2); |