mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r25648) -Change [FS#5669]: [NewGRF] Invalidate vehicle recolour palette during (un)loading.
This commit is contained in:
parent
a3efc99034
commit
5bda07c10c
|
@ -1153,7 +1153,8 @@ TileIndex Aircraft::GetOrderStationLocation(StationID station)
|
|||
|
||||
void Aircraft::MarkDirty()
|
||||
{
|
||||
this->UpdateViewport(false, false);
|
||||
this->colourmap = PAL_NONE;
|
||||
this->UpdateViewport(true, false);
|
||||
if (this->subtype == AIR_HELICOPTER) this->Next()->Next()->cur_image = GetRotorImage(this, EIT_ON_MAP);
|
||||
}
|
||||
|
||||
|
|
|
@ -234,9 +234,6 @@ void RoadVehUpdateCache(RoadVehicle *v, bool same_length)
|
|||
/* Update visual effect */
|
||||
v->UpdateVisualEffect();
|
||||
|
||||
/* Invalidate the vehicle colour map */
|
||||
u->colourmap = PAL_NONE;
|
||||
|
||||
/* Update cargo aging period. */
|
||||
u->vcache.cached_cargo_age_period = GetVehicleProperty(u, PROP_ROADVEH_CARGO_AGE_PERIOD, EngInfo(u->engine_type)->cargo_age_period);
|
||||
}
|
||||
|
@ -394,7 +391,8 @@ CommandCost CmdTurnRoadVeh(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
|||
void RoadVehicle::MarkDirty()
|
||||
{
|
||||
for (RoadVehicle *v = this; v != NULL; v = v->Next()) {
|
||||
v->UpdateViewport(false, false);
|
||||
v->colourmap = PAL_NONE;
|
||||
v->UpdateViewport(true, false);
|
||||
}
|
||||
this->CargoChanged();
|
||||
}
|
||||
|
|
|
@ -245,7 +245,8 @@ Trackdir Ship::GetVehicleTrackdir() const
|
|||
|
||||
void Ship::MarkDirty()
|
||||
{
|
||||
this->UpdateViewport(false, false);
|
||||
this->colourmap = PAL_NONE;
|
||||
this->UpdateViewport(true, false);
|
||||
this->UpdateCache();
|
||||
}
|
||||
|
||||
|
|
|
@ -165,9 +165,6 @@ void Train::ConsistChanged(bool same_length)
|
|||
/* Cache wagon override sprite group. NULL is returned if there is none */
|
||||
u->tcache.cached_override = GetWagonOverrideSpriteSet(u->engine_type, u->cargo_type, u->gcache.first_engine);
|
||||
|
||||
/* Reset colour map */
|
||||
u->colourmap = PAL_NONE;
|
||||
|
||||
/* Update powered-wagon-status and visual effect */
|
||||
u->UpdateVisualEffect(true);
|
||||
|
||||
|
@ -2762,7 +2759,8 @@ void Train::MarkDirty()
|
|||
{
|
||||
Train *v = this;
|
||||
do {
|
||||
v->UpdateViewport(false, false);
|
||||
v->colourmap = PAL_NONE;
|
||||
v->UpdateViewport(true, false);
|
||||
} while ((v = v->Next()) != NULL);
|
||||
|
||||
/* need to update acceleration and cached values since the goods on the train changed. */
|
||||
|
|
|
@ -851,11 +851,12 @@ static void RunVehicleDayProc()
|
|||
uint16 callback = GetVehicleCallback(CBID_VEHICLE_32DAY_CALLBACK, 0, 0, v->engine_type, v);
|
||||
if (callback != CALLBACK_FAILED) {
|
||||
if (HasBit(callback, 0)) {
|
||||
/* After a vehicle trigger, the graphics and properties of the vehicle could change. */
|
||||
TriggerVehicle(v, VEHICLE_TRIGGER_CALLBACK_32); // Trigger vehicle trigger 10
|
||||
v->MarkDirty();
|
||||
}
|
||||
if (HasBit(callback, 1)) v->colourmap = PAL_NONE;
|
||||
|
||||
/* After a vehicle trigger, the graphics and properties of the vehicle could change.
|
||||
* Note: MarkDirty also invalidates the palette, which is the meaning of bit 1. So, nothing special there. */
|
||||
if (callback != 0) v->MarkDirty();
|
||||
|
||||
if (callback & ~3) ErrorUnknownCallbackResult(v->GetGRFID(), CBID_VEHICLE_32DAY_CALLBACK, callback);
|
||||
}
|
||||
|
|
|
@ -478,18 +478,17 @@ CommandCost CmdRefitVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
|||
|
||||
case VEH_SHIP:
|
||||
v->InvalidateNewGRFCacheOfChain();
|
||||
v->colourmap = PAL_NONE; // invalidate vehicle colour map
|
||||
Ship::From(v)->UpdateCache();
|
||||
break;
|
||||
|
||||
case VEH_AIRCRAFT:
|
||||
v->InvalidateNewGRFCacheOfChain();
|
||||
v->colourmap = PAL_NONE; // invalidate vehicle colour map
|
||||
UpdateAircraftCache(Aircraft::From(v), true);
|
||||
break;
|
||||
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
front->MarkDirty();
|
||||
|
||||
InvalidateWindowData(WC_VEHICLE_DETAILS, front->index);
|
||||
SetWindowDirty(WC_VEHICLE_DEPOT, front->tile);
|
||||
|
|
Loading…
Reference in New Issue