Mercurial > hg > openttd
changeset 16863:d71ff96cc22c draft
(svn r21597) -Fix (r21239): Also catch the case when callback 10 returns VE_DEFAULT.
author | frosch <frosch@openttd.org> |
---|---|
date | Wed, 22 Dec 2010 14:51:12 +0000 |
parents | b36044db5a61 |
children | d16afc89472a |
files | src/vehicle.cpp |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1923,7 +1923,16 @@ 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)) {