changeset 18490:66f5e8825c2f draft

(svn r23334) -Fix [FS#4820]: Road vehicle purchase info failed to display vehicles carrying no cargo. (Can only happen when NewGRFs are screwed up.)
author frosch <frosch@openttd.org>
date Sat, 26 Nov 2011 14:51:06 +0000
parents f72f7dfd6c0e
children b29b61d08720
files src/build_vehicle_gui.cpp
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -629,7 +629,7 @@
 		/* Road vehicle weight - (including cargo) */
 		int16 weight = e->GetDisplayWeight();
 		SetDParam(0, weight);
-		uint cargo_weight = CargoSpec::Get(e->GetDefaultCargoType())->weight * GetTotalCapacityOfArticulatedParts(engine_number) / 16;
+		uint cargo_weight = (e->CanCarryCargo() ? CargoSpec::Get(e->GetDefaultCargoType())->weight * GetTotalCapacityOfArticulatedParts(engine_number) / 16 : 0);
 		SetDParam(1, cargo_weight + weight);
 		DrawString(left, right, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT);
 		y += FONT_HEIGHT_NORMAL;