Changeset - r16853:e4ea4243e420
[Not reviewed]
master
0 1 0
frosch - 13 years ago 2010-12-22 14:51:12
frosch@openttd.org
(svn r21597) -Fix (r21239): Also catch the case when callback 10 returns VE_DEFAULT.
1 file changed with 10 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -1923,7 +1923,16 @@ void Vehicle::UpdateVisualEffect(bool al
 
	if (HasBit(e->info.callback_mask, CBM_VEHICLE_VISUAL_EFFECT)) {
 
		uint16 callback = GetVehicleCallback(CBID_VEHICLE_VISUAL_EFFECT, 0, 0, this->engine_type, this);
 

	
 
		if (callback != CALLBACK_FAILED) this->vcache.cached_vis_effect = GB(callback, 0, 8);
 
		if (callback != CALLBACK_FAILED) {
 
			callback = GB(callback, 0, 8);
 
			/* Avoid accidentally setting 'visual_effect' to the default value
 
			 * Since bit 6 (disable effects) is set anyways, we can safely erase some bits. */
 
			if (callback == VE_DEFAULT) {
 
				assert(HasBit(callback, VE_DISABLE_EFFECT));
 
				SB(callback, VE_TYPE_START, VE_TYPE_COUNT, 0);
 
			}
 
			this->vcache.cached_vis_effect = callback;
 
		}
 
	}
 

	
 
	if (!allow_power_change && powered_before != HasBit(this->vcache.cached_vis_effect, VE_DISABLE_WAGON_POWER)) {
0 comments (0 inline, 0 general)