summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-04-13 13:42:08 +0000
committerfrosch <frosch@openttd.org>2013-04-13 13:42:08 +0000
commit5eddbb338b7838c01087921c77c0738fc12cbfb2 (patch)
treee1d1b917bc00b6e7e43aad49188c98b635887b12 /src/station_cmd.cpp
parent8d1d521456c57b69243853b369ecc60de0421e33 (diff)
downloadopenttd-5eddbb338b7838c01087921c77c0738fc12cbfb2.tar.xz
(svn r25185) -Fix [FS#5508]: Remove ambivalent functions CargoList::Empty() and Count(), and replace them with VehicleCargoList::StoredCount(), TotalCount(), StationCargoList::AvailableCount() and TotalCount(). (fonsinchen)
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 67933160d..34304fbd4 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3225,7 +3225,7 @@ static void UpdateStationRating(Station *st)
bool skip = false;
int rating = 0;
- uint waiting = ge->cargo.Count();
+ uint waiting = ge->cargo.TotalCount();
if (HasBit(cs->callback_mask, CBM_CARGO_STATION_RATING_CALC)) {
/* Perform custom station rating. If it succeeds the speed, days in transit and
@@ -3315,8 +3315,10 @@ static void UpdateStationRating(Station *st)
waiting_changed = true;
}
- if (waiting_changed && waiting < ge->cargo.Count()) {
- ge->cargo.Truncate(ge->cargo.Count() - waiting);
+ /* We can't truncate cargo that's already reserved for loading.
+ * Thus StoredCount() here. */
+ if (waiting_changed && waiting < ge->cargo.AvailableCount()) {
+ ge->cargo.Truncate(ge->cargo.AvailableCount() - waiting);
}
}
}