(svn r8381) -Fix (r8377): [build vehicle window] cleaned up the train refitable detection. It had two variables doing the same thing, but not always set to the same (oops)
authorbjarni
Tue, 23 Jan 2007 21:24:26 +0000
changeset 6070 e5a6d7b94c63
parent 6069 8274f3327a2f
child 6071 c37b45d0109b
(svn r8381) -Fix (r8377): [build vehicle window] cleaned up the train refitable detection. It had two variables doing the same thing, but not always set to the same (oops)
src/build_vehicle_gui.cpp
--- a/src/build_vehicle_gui.cpp	Tue Jan 23 20:55:08 2007 +0000
+++ b/src/build_vehicle_gui.cpp	Tue Jan 23 21:24:26 2007 +0000
@@ -535,12 +535,12 @@
 		case VEH_Train: {
 			const RailVehicleInfo *rvi = RailVehInfo(engine_number);
 
+			refitable = (EngInfo(engine_number)->refit_mask != 0) && (rvi->capacity > 0);
+
 			if (rvi->flags & RVI_WAGON) {
 				y = DrawRailWagonPurchaseInfo(x, y, engine_number, rvi);
-				refitable = true;
 			} else {
 				y = DrawRailEnginePurchaseInfo(x, y, engine_number, rvi, e);
-				refitable = (rvi->capacity > 0);
 			}
 
 			/* Cargo type + capacity, or N/A */
@@ -549,11 +549,10 @@
 				SetDParam(2, STR_EMPTY);
 			} else {
 				int multihead = (rvi->flags & RVI_MULTIHEAD ? 1 : 0);
-				bool refittable = (EngInfo(engine_number)->refit_mask != 0);
 
 				SetDParam(0, rvi->cargo_type);
 				SetDParam(1, (rvi->capacity * (CountArticulatedParts(engine_number) + 1)) << multihead);
-				SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
+				SetDParam(2, refitable ? STR_9842_REFITTABLE : STR_EMPTY);
 			}
 			DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
 			y += 10;