From 20dd0bb9bb64ce84d668cffa0a2628e5d09d1ada Mon Sep 17 00:00:00 2001 From: dP Date: Sun, 31 Oct 2021 03:57:18 +0300 Subject: [PATCH] Fix polyrail tool terra highlight getting stuck after closing tool --- src/citymania/cm_highlight.cpp | 4 ++-- src/main_gui.cpp | 1 + src/rail_gui.cpp | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/citymania/cm_highlight.cpp b/src/citymania/cm_highlight.cpp index 06f53284ee..43491fda47 100644 --- a/src/citymania/cm_highlight.cpp +++ b/src/citymania/cm_highlight.cpp @@ -1458,14 +1458,14 @@ HighLightStyle UpdateTileSelection(HighLightStyle new_drawstyle) { } } new_drawstyle = HT_RECT; - } else if (_thd.cm_new_poly_terra) { + } else if ((_thd.place_mode & HT_POLY) && _thd.cm_new_poly_terra) { _thd.cm_new = ObjectHighlight::make_polyrail(TileVirtXY(_thd.selstart.x, _thd.selstart.y), TileVirtXY(_thd.selend.x, _thd.selend.y), _thd.cm_poly_dir, TileVirtXY(_thd.selstart2.x, _thd.selstart2.y), TileVirtXY(_thd.selend2.x, _thd.selend2.y), _thd.cm_poly_dir2); -} + } if (_thd.cm != _thd.cm_new) { _thd.cm.MarkDirty(); _thd.cm = _thd.cm_new; diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 036debb6f3..6404196522 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -45,6 +45,7 @@ #include "table/sprites.h" #include "table/strings.h" +#include "debug.h" #include "safeguards.h" diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp index 52b2885400..2072e6a903 100644 --- a/src/rail_gui.cpp +++ b/src/rail_gui.cpp @@ -1089,9 +1089,9 @@ struct BuildRailToolbarWindow : Window { EventState CM_OnFnModStateChange() override { - if (_settings_client.gui.cm_enable_polyrail_terraform && this->IsWidgetLowered(WID_RAT_POLYRAIL)) { - return ES_HANDLED; - } + // if (_settings_client.gui.cm_enable_polyrail_terraform && this->IsWidgetLowered(WID_RAT_POLYRAIL)) { + // return ES_HANDLED; + // } return ES_NOT_HANDLED; }