(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
authorbjarni
Sat, 19 Jan 2008 22:47:07 +0000
changeset 8858 576be95ed078
parent 8857 df06e88e5dbd
child 8859 c5a71ed49252
(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)
src/autoreplace_cmd.cpp
--- a/src/autoreplace_cmd.cpp	Sat Jan 19 18:24:20 2008 +0000
+++ b/src/autoreplace_cmd.cpp	Sat Jan 19 22:47:07 2008 +0000
@@ -93,7 +93,7 @@
 
 	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 {