summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-01-11 14:40:12 +0000
committerpeter1138 <peter1138@openttd.org>2007-01-11 14:40:12 +0000
commit8d5a542d9b7e318a375b279faac264d7dccf4a57 (patch)
treedd97d1fd78e49bea04d2e16c74bf7ef575b8ad1c
parentb7e753555d418d033249fd967bb74e718cbaa524 (diff)
downloadopenttd-8d5a542d9b7e318a375b279faac264d7dccf4a57.tar.xz
(svn r8063) -Codechange: When evaluating newgrf varaction2s the 'last value' should start off at 0, and the result of the operation is remembered.
-rw-r--r--src/newgrf_spritegroup.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp
index fcff45eb7..e187ddd9f 100644
--- a/src/newgrf_spritegroup.cpp
+++ b/src/newgrf_spritegroup.cpp
@@ -131,7 +131,7 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, U last_value,
static inline const SpriteGroup *ResolveVariable(const SpriteGroup *group, ResolverObject *object)
{
static SpriteGroup nvarzero;
- uint32 last_value = object->last_value;
+ uint32 last_value = 0;
uint32 value = 0;
uint i;
@@ -159,6 +159,8 @@ static inline const SpriteGroup *ResolveVariable(const SpriteGroup *group, Resol
last_value = value;
}
+ object->last_value = last_value;
+
if (group->g.determ.num_ranges == 0) {
/* nvar == 0 is a special case -- we turn our value into a callback result */
nvarzero.type = SGT_CALLBACK;