# HG changeset patch # User rubidium # Date 1282318514 0 # Node ID cfe6456564b2779804876b61c8078f3ce5f60e8a # Parent d613f94dd4ab31e721a5105c47d706082ef0f126 (svn r20581) -Codechange: simplify getting the station in CalcPercentVehicleFilled diff --git a/src/vehicle.cpp b/src/vehicle.cpp --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -1038,7 +1038,9 @@ 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()) {