src/train_cmd.cpp
changeset 6417 26acff62d001
parent 6324 ebf3649bd88f
child 6440 14530751458a
--- a/src/train_cmd.cpp	Tue Feb 20 17:52:43 2007 +0000
+++ b/src/train_cmd.cpp	Tue Feb 20 22:09:21 2007 +0000
@@ -33,6 +33,7 @@
 #include "direction.h"
 #include "yapf/yapf.h"
 #include "date.h"
+#include "cargotype.h"
 
 static bool TrainCheckIfLineEnds(Vehicle *v);
 static void TrainController(Vehicle *v, bool update_image);
@@ -106,7 +107,7 @@
 
 	for (u = v; u != NULL; u = u->next) {
 		const RailVehicleInfo *rvi = RailVehInfo(u->engine_type);
-		uint32 vweight = (_cargoc.weights[u->cargo_type] * u->cargo_count * FreightWagonMult(u->cargo_type)) / 16;
+		uint32 vweight = (GetCargo(u->cargo_type)->weight * u->cargo_count * FreightWagonMult(u->cargo_type)) / 16;
 
 		// Vehicle weight is not added for articulated parts.
 		if (!IsArticulatedPart(u)) {