diff options
author | rubidium <rubidium@openttd.org> | 2010-08-20 15:35:14 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-08-20 15:35:14 +0000 |
commit | d6cd62e633f8ec7ef15fac4c2d5c1ae120b9ad03 (patch) | |
tree | fe58a07f7e72089b0e4f84604db3e8a8f21fb54c | |
parent | f3864181b66f7a083679d8e4f08da8a37b6b1fa3 (diff) | |
download | openttd-d6cd62e633f8ec7ef15fac4c2d5c1ae120b9ad03.tar.xz |
(svn r20581) -Codechange: simplify getting the station in CalcPercentVehicleFilled
-rw-r--r-- | src/vehicle.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp index c19d03abc..5384f2954 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1038,7 +1038,9 @@ uint8 CalcPercentVehicleFilled(const Vehicle *v, StringID *colour) bool loading = false; const Vehicle *u = v; - const Station *st = v->last_station_visited != INVALID_STATION ? Station::Get(v->last_station_visited) : NULL; + /* The station may be NULL when the (colour) string does not need to be set. */ + const Station *st = Station::GetIfValid(v->last_station_visited); + assert(colour == NULL || st != NULL); /* Count up max and used */ for (; v != NULL; v = v->Next()) { |