From d2e8d205b90f37c151c7ef1f85f7f404585c6051 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 14 Jan 2016 19:09:34 +0000 Subject: [PATCH 1/2] Tracerestrict: Fix copying an unrestricted signal making an empty program. --- src/tracerestrict.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tracerestrict.cpp b/src/tracerestrict.cpp index caeb935acc..9100f1a8ae 100644 --- a/src/tracerestrict.cpp +++ b/src/tracerestrict.cpp @@ -1002,17 +1002,17 @@ CommandCost CmdProgramSignalTraceRestrictProgMgmt(TileIndex tile, DoCommandFlag switch (type) { case TRDCT_PROG_COPY: { TraceRestrictRemoveProgramMapping(self); - TraceRestrictProgram *prog = GetTraceRestrictProgram(self, true); - if (!prog) { - // allocation failed - return CMD_ERROR; - } TraceRestrictProgram *source_prog = GetTraceRestrictProgram(source, false); - if (source_prog) { + if (source_prog && !source_prog->items.empty()) { + TraceRestrictProgram *prog = GetTraceRestrictProgram(self, true); + if (!prog) { + // allocation failed + return CMD_ERROR; + } prog->items = source_prog->items; // copy + prog->Validate(); } - prog->Validate(); break; } From b5b06351ac85aa999ab8b926437c29a561057f7b Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 14 Jan 2016 19:12:54 +0000 Subject: [PATCH 2/2] Tracerestrict: Fix GUI issue with picker button raise/lower states. When a picker button was selected, clicking on a different picker button would cause both buttons to be raised, instead of just the previous. --- src/tracerestrict_gui.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tracerestrict_gui.cpp b/src/tracerestrict_gui.cpp index 22c7f5471f..5811e52afb 100644 --- a/src/tracerestrict_gui.cpp +++ b/src/tracerestrict_gui.cpp @@ -1645,6 +1645,9 @@ private: */ void SetObjectToPlaceAction(int widget, CursorID cursor) { + if (this->current_placement_widget != -1 && widget != this->current_placement_widget) { + ResetObjectToPlace(); + } this->ToggleWidgetLoweredState(widget); this->SetWidgetDirty(widget); if (this->IsWidgetLowered(widget)) {