changeset 15898:cfe6456564b2 draft

(svn r20581) -Codechange: simplify getting the station in CalcPercentVehicleFilled
author rubidium <rubidium@openttd.org>
date Fri, 20 Aug 2010 15:35:14 +0000
parents d613f94dd4ab
children 097904c36bde
files src/vehicle.cpp
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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()) {