summaryrefslogtreecommitdiff
path: root/src/autoreplace_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-05-19 20:15:50 +0000
committerrubidium <rubidium@openttd.org>2007-05-19 20:15:50 +0000
commit6ef7915e6e741164e66a56fd3e8a7e8a43601ade (patch)
treea86b9a0bbe394018a8dda5c3e9aa16c67ebd625f /src/autoreplace_cmd.cpp
parent1e696cc27b13cf361c0a1ffdd0bb4c6a46360c2d (diff)
downloadopenttd-6ef7915e6e741164e66a56fd3e8a7e8a43601ade.tar.xz
(svn r9881) -Fix (FS#782, r9874): accidentally removed one condition too many causing asserts.
Diffstat (limited to 'src/autoreplace_cmd.cpp')
-rw-r--r--src/autoreplace_cmd.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index e62dbccda..776320e04 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -149,6 +149,8 @@ static int32 ReplaceVehicle(Vehicle **w, byte flags, int32 total_cost)
new_engine_type = EngineReplacementForPlayer(p, old_v->engine_type, old_v->group_id);
}
+ if (new_engine_type == INVALID_ENGINE) new_engine_type = old_v->engine_type;
+
replacement_cargo_type = GetNewCargoTypeForReplace(old_v, new_engine_type);
/* check if we can't refit to the needed type, so no replace takes place to prevent the vehicle from altering cargo type */