Changeset - r17833:6e30fcc94ba8
[Not reviewed]
master
0 13 0
frosch - 13 years ago 2011-07-04 20:31:57
frosch@openttd.org
(svn r22634) -Codechange: Deduplicate some code. Note that zeroing 'count' is intentionally removed, it is only used together with 'scope'.
13 files changed with 27 insertions and 48 deletions:
0 comments (0 inline, 0 general)
src/newgrf_airport.cpp
Show inline comments
 
@@ -224,10 +224,7 @@ static void NewAirportResolver(ResolverO
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	const AirportSpec *as = AirportSpec::Get(airport_id);
 
	res->grffile         = as->grf_prop.grffile;
src/newgrf_airporttiles.cpp
Show inline comments
 
@@ -238,10 +238,7 @@ static void AirportTileResolver(Resolver
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	res->grffile         = ats->grf_prop.grffile;
 
}
src/newgrf_canal.cpp
Show inline comments
 
@@ -89,10 +89,8 @@ static void NewCanalResolver(ResolverObj
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	res->grffile         = grffile;
 
}
 

	
src/newgrf_cargo.cpp
Show inline comments
 
@@ -66,10 +66,8 @@ static void NewCargoResolver(ResolverObj
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	res->grffile         = cs->grffile;
 
}
 

	
src/newgrf_engine.cpp
Show inline comments
 
@@ -878,10 +878,7 @@ static inline void NewVehicleResolver(Re
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	const Engine *e = Engine::Get(engine_type);
 
	res->grffile         = (e != NULL ? e->grf_prop.grffile : NULL);
src/newgrf_generic.cpp
Show inline comments
 
@@ -126,10 +126,8 @@ static inline void NewGenericResolver(Re
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	res->grffile         = grffile;
 
}
 

	
src/newgrf_house.cpp
Show inline comments
 
@@ -397,10 +397,7 @@ static void NewHouseResolver(ResolverObj
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	const HouseSpec *hs  = HouseSpec::Get(house_id);
 
	res->grffile         = (hs != NULL ? hs->grf_prop.grffile : NULL);
src/newgrf_industries.cpp
Show inline comments
 
@@ -424,10 +424,7 @@ static void NewIndustryResolver(Resolver
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	const IndustrySpec *indspec = GetIndustrySpec(type);
 
	res->grffile         = (indspec != NULL ? indspec->grf_prop.grffile : NULL);
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -190,10 +190,7 @@ static void NewIndustryTileResolver(Reso
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	const IndustryTileSpec *its = GetIndustryTileSpec(gfx);
 
	res->grffile         = (its != NULL ? its->grf_prop.grffile : NULL);
src/newgrf_object.cpp
Show inline comments
 
@@ -393,10 +393,7 @@ static void NewObjectResolver(ResolverOb
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	res->grffile = spec->grf_prop.grffile;
 
}
src/newgrf_railtype.cpp
Show inline comments
 
@@ -81,10 +81,7 @@ static inline void NewRailTypeResolver(R
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	res->grffile         = grffile;
 
}
src/newgrf_spritegroup.h
Show inline comments
 
@@ -381,6 +381,17 @@ struct ResolverObject {
 
	uint32 (*GetVariable)(const struct ResolverObject*, byte, byte, bool*);
 
	const SpriteGroup *(*ResolveReal)(const struct ResolverObject*, const RealSpriteGroup*);
 
	void (*StorePSA)(struct ResolverObject*, uint, int32);
 

	
 
	/**
 
	 * Resets the dynamic state of the resolver object.
 
	 * To be called before resolving an Action-1-2-3 chain.
 
	 */
 
	void ResetState()
 
	{
 
		this->last_value = 0;
 
		this->trigger    = 0;
 
		this->reseed     = 0;
 
	}
 
};
 

	
 
#endif /* NEWGRF_SPRITEGROUP_H */
src/newgrf_station.cpp
Show inline comments
 
@@ -548,10 +548,8 @@ static void NewStationResolver(ResolverO
 
	res->callback        = CBID_NO_CALLBACK;
 
	res->callback_param1 = 0;
 
	res->callback_param2 = 0;
 
	res->last_value      = 0;
 
	res->trigger         = 0;
 
	res->reseed          = 0;
 
	res->count           = 0;
 
	res->ResetState();
 

	
 
	res->grffile         = (statspec != NULL ? statspec->grf_prop.grffile : NULL);
 

	
 
	/* Invalidate all cached vars */
0 comments (0 inline, 0 general)