summaryrefslogtreecommitdiff
path: root/src/autoreplace_cmd.cpp
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2008-01-19 22:47:07 +0000
committerbjarni <bjarni@openttd.org>2008-01-19 22:47:07 +0000
commit2f6ee3a4a119fbddb7dcde34c8ceaf5ac63efb14 (patch)
tree87ce9845a3df76f29ef682347809dae62c3dab5a /src/autoreplace_cmd.cpp
parenta580c8d0599e76877e21971fa644964c2ba5bcc8 (diff)
downloadopenttd-2f6ee3a4a119fbddb7dcde34c8ceaf5ac63efb14.tar.xz
(svn r11928) -Fix (r6393): [autoreplace] autoreplace could refit train engines to the wrong cargo type if the old engine had no cargo capacity and the new one had
Now autoreplace will always look at the wagons to figure out what to replace to (as originally intended)
Diffstat (limited to 'src/autoreplace_cmd.cpp')
-rw-r--r--src/autoreplace_cmd.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index f0a8f171a..ef5e0d70f 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -93,7 +93,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type)
if (new_cargo_type == CT_INVALID) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity
- if (v->cargo_type == new_cargo_type || CanRefitTo(engine_type, v->cargo_type)) {
+ if (v->cargo_cap != 0 && (v->cargo_type == new_cargo_type || CanRefitTo(engine_type, v->cargo_type))) {
if (VerifyAutoreplaceRefitForOrders(v, engine_type)) {
return v->cargo_type == new_cargo_type ? (CargoID)CT_NO_REFIT : v->cargo_type;
} else {