summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-08-04 14:02:27 +0000
committerfrosch <frosch@openttd.org>2013-08-04 14:02:27 +0000
commit5bda07c10ca4ad1e75dd632a1829a422e862f66a (patch)
tree1874bc3c65e729de6f96db5b7a126e47849ff5b5 /src
parenta3efc99034ad933b70fb3af4ca9be267468ad221 (diff)
downloadopenttd-5bda07c10ca4ad1e75dd632a1829a422e862f66a.tar.xz
(svn r25648) -Change [FS#5669]: [NewGRF] Invalidate vehicle recolour palette during (un)loading.
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp3
-rw-r--r--src/roadveh_cmd.cpp6
-rw-r--r--src/ship_cmd.cpp3
-rw-r--r--src/train_cmd.cpp6
-rw-r--r--src/vehicle.cpp7
-rw-r--r--src/vehicle_cmd.cpp3
6 files changed, 13 insertions, 15 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index e0eb3558e..fb817b351 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -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);
}
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index a204c391c..aa4791bf7 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -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();
}
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index ea1233da4..bafce981f 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -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();
}
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index ddbc5cdf6..0b0c0b328 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -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. */
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index de3e1c02c..990eaf303 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -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);
}
diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp
index a7e2f305b..8bd6f1b9f 100644
--- a/src/vehicle_cmd.cpp
+++ b/src/vehicle_cmd.cpp
@@ -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);