diff options
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r-- | src/station_cmd.cpp | 8 |
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); } } } |