Changeset - r13157:6b5799323a00
[Not reviewed]
master
0 2 0
frosch - 15 years ago 2009-09-30 20:25:59
frosch@openttd.org
(svn r17672) -Revert (r8081): 'last_value' and 'reseed' are shared between procedure and main chain.
-Fix (r8075): 'scope' and 'count' are not.
2 files changed with 13 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/newgrf_spritegroup.cpp
Show inline comments
 
@@ -142,13 +142,16 @@ const SpriteGroup *DeterministicSpriteGr
 
		/* Try to get the variable. We shall assume it is available, unless told otherwise. */
 
		bool available = true;
 
		if (adjust->variable == 0x7E) {
 
			ResolverObject subobject = *object;
 
			const SpriteGroup *subgroup = SpriteGroup::Resolve(adjust->subroutine, &subobject);
 
			const SpriteGroup *subgroup = SpriteGroup::Resolve(adjust->subroutine, object);
 
			if (subgroup == NULL) {
 
				value = CALLBACK_FAILED;
 
			} else {
 
				value = subgroup->GetCallbackResult();
 
			}
 

	
 
			/* Reset values to current scope.
 
			 * Note: 'last_value' and 'reseed' are shared between the main chain and the procedure */
 
			object->scope = this->var_scope;
 
		} else {
 
			value = GetVariable(object, adjust->variable, adjust->parameter, &available);
 
		}
src/newgrf_spritegroup.h
Show inline comments
 
@@ -291,14 +291,16 @@ struct ResolverObject {
 
	uint32 callback_param2;
 

	
 
	byte trigger;
 
	byte count;
 
	uint32 last_value;
 
	uint32 reseed;
 
	VarSpriteGroupScope scope;
 

	
 
	uint32 last_value;          ///< Result of most recent DeterministicSpriteGroup (including procedure calls)
 
	uint32 reseed;              ///< Collects bits to rerandomise while triggering triggers.
 

	
 
	BaseStorageArray *psa; ///< The persistent storage array of this resolved object.
 
	VarSpriteGroupScope scope;  ///< Scope of currently resolved DeterministicSpriteGroup resp. RandomizedSpriteGroup
 
	byte count;                 ///< Additional scope for RandomizedSpriteGroup
 

	
 
	const GRFFile *grffile; ///< GRFFile the resolved SpriteGroup belongs to
 
	BaseStorageArray *psa;      ///< The persistent storage array of this resolved object.
 

	
 
	const GRFFile *grffile;     ///< GRFFile the resolved SpriteGroup belongs to
 

	
 
	union {
 
		struct {
0 comments (0 inline, 0 general)