summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2005-12-13 12:31:48 +0000
committerpeter1138 <peter1138@openttd.org>2005-12-13 12:31:48 +0000
commit560a4a9c4aa3e5af724038a4ee073653a25284ca (patch)
tree13702d35b3ec3528d823c1375b8ce3bd23b3075d
parent04f39ef749fa6cec63f4062bbf08d478eef3ccf3 (diff)
downloadopenttd-560a4a9c4aa3e5af724038a4ee073653a25284ca.tar.xz
(svn r3292) - Autoreplace: Disallow replacing to an engine type that already has a replacement set up; this stops loops being set up.
-rw-r--r--vehicle_gui.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 803b11878..1f135955d 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -831,10 +831,12 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
// Disable the "Start Replacing" button if:
// Either list is empty
// or Both lists have the same vehicle selected
+ // or The selected replacement engine has a replacement (to prevent loops)
// or The right list (new replacement) has the existing replacement vehicle selected
if (selected_id[0] == INVALID_ENGINE ||
selected_id[1] == INVALID_ENGINE ||
selected_id[0] == selected_id[1] ||
+ EngineReplacement(p, selected_id[1]) != INVALID_ENGINE ||
EngineReplacement(p, selected_id[0]) == selected_id[1]) {
SETBIT(w->disabled_state, 4);
} else {