summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build_vehicle_gui.cpp50
1 files changed, 22 insertions, 28 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 2f6a5771c..a6920a925 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -629,53 +629,47 @@ int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number)
YearMonthDay ymd;
ConvertDateToYMD(e->intro_date, &ymd);
bool refittable = IsArticulatedVehicleRefittable(engine_number);
+ bool articulated_cargo = false;
switch (e->type) {
default: NOT_REACHED();
- case VEH_TRAIN: {
+ case VEH_TRAIN:
if (e->u.rail.railveh_type == RAILVEH_WAGON) {
y = DrawRailWagonPurchaseInfo(left, right, y, engine_number, &e->u.rail);
} else {
y = DrawRailEnginePurchaseInfo(left, right, y, engine_number, &e->u.rail);
}
-
- /* Cargo type + capacity, or N/A */
- int new_y = DrawCargoCapacityInfo(left, right, y, engine_number, refittable);
-
- if (new_y == y) {
- SetDParam(0, CT_INVALID);
- SetDParam(2, STR_EMPTY);
- DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY);
- y += FONT_HEIGHT_NORMAL;
- } else {
- y = new_y;
- }
+ articulated_cargo = true;
break;
- }
- case VEH_ROAD: {
- y = DrawRoadVehPurchaseInfo(left, right, y, engine_number);
-
- /* Cargo type + capacity, or N/A */
- int new_y = DrawCargoCapacityInfo(left, right, y, engine_number, refittable);
- if (new_y == y) {
- SetDParam(0, CT_INVALID);
- SetDParam(2, STR_EMPTY);
- DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY);
- y += FONT_HEIGHT_NORMAL;
- } else {
- y = new_y;
- }
+ case VEH_ROAD:
+ y = DrawRoadVehPurchaseInfo(left, right, y, engine_number);
+ articulated_cargo = true;
break;
- }
+
case VEH_SHIP:
y = DrawShipPurchaseInfo(left, right, y, engine_number, &e->u.ship, refittable);
break;
+
case VEH_AIRCRAFT:
y = DrawAircraftPurchaseInfo(left, right, y, engine_number, &e->u.air, refittable);
break;
}
+ if (articulated_cargo) {
+ /* Cargo type + capacity, or N/A */
+ int new_y = DrawCargoCapacityInfo(left, right, y, engine_number, refittable);
+
+ if (new_y == y) {
+ SetDParam(0, CT_INVALID);
+ SetDParam(2, STR_EMPTY);
+ DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY);
+ y += FONT_HEIGHT_NORMAL;
+ } else {
+ y = new_y;
+ }
+ }
+
/* Draw details, that applies to all types except rail wagons */
if (e->type != VEH_TRAIN || e->u.rail.railveh_type != RAILVEH_WAGON) {
/* Design date - Life length */