summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2014-05-11 18:31:38 +0000
committerrubidium <rubidium@openttd.org>2014-05-11 18:31:38 +0000
commitb590a647188a8c98efca81f81cf7cb1a1c6228e1 (patch)
treec48c470c29038d817332c0a7648267bb214b028f /src
parent89c25b955e636efa46d65ebf5b4782b77f30f764 (diff)
downloadopenttd-b590a647188a8c98efca81f81cf7cb1a1c6228e1.tar.xz
(svn r26581) -Fix [FS#5989]: transfering cargo to a station doesn't give that station a rating and thus the cargo does not decay... until the first pickup happens
For cargo drops from industries/houses, the station gets a rating too so why not when cargo is dropped at the station from a train?
Diffstat (limited to 'src')
-rw-r--r--src/economy.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index cf74a9d6e..0d3902dfa 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1558,8 +1558,18 @@ static void LoadUnloadVehicle(Vehicle *front)
}
}
- /* Mark the station dirty if we transfer, but not if we only deliver. */
- dirty_station = v->cargo.ActionCount(VehicleCargoList::MTA_TRANSFER) > 0;
+ if (v->cargo.ActionCount(VehicleCargoList::MTA_TRANSFER) > 0) {
+ /* Mark the station dirty if we transfer, but not if we only deliver. */
+ dirty_station = true;
+
+ if (!ge->HasRating()) {
+ /* Upon transfering cargo, make sure the station has a rating. Fake a pickup for the
+ * first unload to prevent the cargo from quickly decaying after the initial drop. */
+ ge->time_since_pickup = 0;
+ SetBit(ge->status, GoodsEntry::GES_RATING);
+ }
+ }
+
amount_unloaded = v->cargo.Unload(amount_unloaded, &ge->cargo, payment);
remaining = v->cargo.UnloadCount() > 0;
if (amount_unloaded > 0) {
@@ -1758,6 +1768,7 @@ static void LoadUnloadVehicle(Vehicle *front)
if (dirty_station) {
st->MarkTilesDirty(true);
SetWindowDirty(WC_STATION_VIEW, last_visited);
+ InvalidateWindowData(WC_STATION_LIST, last_visited);
}
}