summaryrefslogtreecommitdiff
path: root/src/build_vehicle_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-11-26 14:51:06 +0000
committerfrosch <frosch@openttd.org>2011-11-26 14:51:06 +0000
commit3e780a794b46e288b3b7d7ba3f3b670698561ceb (patch)
treecbc16f7cf3d10c8cd95c22083d82e30351b6e8ff /src/build_vehicle_gui.cpp
parent349da42ce37f14b438ed477d7e091d9284c3f085 (diff)
downloadopenttd-3e780a794b46e288b3b7d7ba3f3b670698561ceb.tar.xz
(svn r23334) -Fix [FS#4820]: Road vehicle purchase info failed to display vehicles carrying no cargo. (Can only happen when NewGRFs are screwed up.)
Diffstat (limited to 'src/build_vehicle_gui.cpp')
-rw-r--r--src/build_vehicle_gui.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 91e32d425..d4d78959b 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -629,7 +629,7 @@ static int DrawRoadVehPurchaseInfo(int left, int right, int y, EngineID engine_n
/* 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;