changeset 18243:0f4af8be53f9 draft

(svn r23079) -Fix (r23077): Retain original behaviour in a silly corner case, which saves us making the specs even more convoluted.
author frosch <frosch@openttd.org>
date Tue, 01 Nov 2011 16:18:28 +0000
parents 2eacf17b9ebc
children 8f6022f41538
files src/newgrf.cpp
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -8015,15 +8015,9 @@
 			only_defaultcargo = (ei->refit_mask == 0);
 		}
 
-		/* Clear refit_mask for not refittable ships */
-		if (e->type == VEH_SHIP && !e->u.ship.old_refittable) {
-			ei->refit_mask = 0;
-			only_defaultcargo = true;
-		}
-
 		/* Ensure that the vehicle is either not refittable, or that the default cargo is one of the refittable cargos.
 		 * Note: Vehicles refittable to no cargo are handle differently to vehicle refittable to a single cargo. The latter might have subtypes. */
-		if (!only_defaultcargo && ei->cargo_type != CT_INVALID && !HasBit(ei->refit_mask, ei->cargo_type)) {
+		if (!only_defaultcargo && (e->type != VEH_SHIP || e->u.ship.old_refittable) && ei->cargo_type != CT_INVALID && !HasBit(ei->refit_mask, ei->cargo_type)) {
 			ei->cargo_type = CT_INVALID;
 		}
 
@@ -8031,6 +8025,11 @@
 		 * cargo type. Finally disable the vehicle, if there is still no cargo. */
 		if (ei->cargo_type == CT_INVALID && ei->refit_mask != 0) ei->cargo_type = (CargoID)FindFirstBit(ei->refit_mask);
 		if (ei->cargo_type == CT_INVALID) ei->climates = 0;
+
+		/* Clear refit_mask for not refittable ships */
+		if (e->type == VEH_SHIP && !e->u.ship.old_refittable) {
+			ei->refit_mask = 0;
+		}
 	}
 }