summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2012-01-22 15:53:17 +0000
committerfrosch <frosch@openttd.org>2012-01-22 15:53:17 +0000
commit3c85689b72da74f4e6dd1a53d45c1ccf57ba42a7 (patch)
treea3500cccda0eba169f7748867c0d84aa87e44e79 /src
parent5bf1710a28021f7eef8dcc91cbfe08dd1ad0c215 (diff)
downloadopenttd-3c85689b72da74f4e6dd1a53d45c1ccf57ba42a7.tar.xz
(svn r23836) -Fix (r23145): If a vehicle is not refittable to any cargo in the CTT, then pick the first refittable cargoslot.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 880933074..1ff37d3fd 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -8185,10 +8185,7 @@ static void CalculateRefitMasks()
/* Check if this engine's cargo type is valid. If not, set to the first refittable
* cargo type. Finally disable the vehicle, if there is still no cargo. */
if (ei->cargo_type == CT_INVALID && ei->refit_mask != 0) {
- if (cargo_map_for_first_refittable == NULL) {
- /* Use first refittable cargo slot */
- ei->cargo_type = (CargoID)FindFirstBit(ei->refit_mask);
- } else {
+ if (cargo_map_for_first_refittable != NULL) {
/* Use first refittable cargo from cargo translation table */
byte best_local_slot = 0xFF;
CargoID cargo_type;
@@ -8200,6 +8197,11 @@ static void CalculateRefitMasks()
}
}
}
+
+ if (ei->cargo_type == CT_INVALID) {
+ /* Use first refittable cargo slot */
+ ei->cargo_type = (CargoID)FindFirstBit(ei->refit_mask);
+ }
}
if (ei->cargo_type == CT_INVALID) ei->climates = 0;