From fc9c1c0f4ee60fa21c306706f19e1d7e9f7f8e77 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Tue, 13 Dec 2005 12:31:48 +0000 Subject: (svn r3292) - Autoreplace: Disallow replacing to an engine type that already has a replacement set up; this stops loops being set up. --- vehicle_gui.c | 2 ++ 1 file changed, 2 insertions(+) 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 { -- cgit v1.2.3-70-g09d2