mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r20581) -Codechange: simplify getting the station in CalcPercentVehicleFilled
This commit is contained in:
parent
f3864181b6
commit
d6cd62e633
|
@ -1038,7 +1038,9 @@ uint8 CalcPercentVehicleFilled(const Vehicle *v, StringID *colour)
|
||||||
bool loading = false;
|
bool loading = false;
|
||||||
|
|
||||||
const Vehicle *u = v;
|
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 */
|
/* Count up max and used */
|
||||||
for (; v != NULL; v = v->Next()) {
|
for (; v != NULL; v = v->Next()) {
|
||||||
|
|
Loading…
Reference in New Issue