(svn r8063) -Codechange: When evaluating newgrf varaction2s the 'last value' should start off at 0, and the result of the operation is remembered.
authorpeter1138
Thu, 11 Jan 2007 14:40:12 +0000
changeset 5607 f9ffb623aad9
parent 5606 0b3fb15cbf8f
child 5608 0b0aff054402
(svn r8063) -Codechange: When evaluating newgrf varaction2s the 'last value' should start off at 0, and the result of the operation is remembered.
src/newgrf_spritegroup.cpp
--- a/src/newgrf_spritegroup.cpp	Thu Jan 11 14:25:17 2007 +0000
+++ b/src/newgrf_spritegroup.cpp	Thu Jan 11 14:40:12 2007 +0000
@@ -131,7 +131,7 @@
 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 @@
 		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;