summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rail_gui.c4
-rw-r--r--road_gui.c4
-rw-r--r--viewport.c7
-rw-r--r--viewport.h2
4 files changed, 13 insertions, 4 deletions
diff --git a/rail_gui.c b/rail_gui.c
index 0e8bfc775..708f180f2 100644
--- a/rail_gui.c
+++ b/rail_gui.c
@@ -288,9 +288,9 @@ static void BuildRailClick_Remove(Window *w)
SetWindowDirty(w);
SndPlayFx(SND_15_BEEP);
- _thd.make_square_red = !!((w->click_state ^= (1 << 16)) & (1<<16));
- MarkTileDirty(_thd.pos.x, _thd.pos.y);
+ w->click_state ^= (1 << 16);
_remove_button_clicked = (w->click_state & (1 << 16)) != 0;
+ SetSelectionRed((w->click_state & (1 << 16)) != 0);
// handle station builder
if( w->click_state & (1 << 16) )
diff --git a/road_gui.c b/road_gui.c
index a47c7ab8e..439d86a7f 100644
--- a/road_gui.c
+++ b/road_gui.c
@@ -159,8 +159,8 @@ static void BuildRoadClick_Remove(Window *w)
return;
SetWindowDirty(w);
SndPlayFx(SND_15_BEEP);
- _thd.make_square_red = !!((w->click_state ^= (1 << 11)) & (1<<11));
- MarkTileDirty(_thd.pos.x, _thd.pos.y);
+ w->click_state ^= (1 << 11);
+ SetSelectionRed((w->click_state & (1 << 11)) != 0);
}
static void BuildRoadClick_Landscaping(Window *w)
diff --git a/viewport.c b/viewport.c
index 64b171f2a..91cb9eadd 100644
--- a/viewport.c
+++ b/viewport.c
@@ -1486,6 +1486,13 @@ static void SetSelectionTilesDirty(void)
}
+void SetSelectionRed(bool b)
+{
+ _thd.make_square_red = b;
+ SetSelectionTilesDirty();
+}
+
+
static bool CheckClickOnTown(ViewPort *vp, int x, int y)
{
Town *t;
diff --git a/viewport.h b/viewport.h
index a92f66a6d..920e09607 100644
--- a/viewport.h
+++ b/viewport.h
@@ -11,6 +11,8 @@ struct ViewPort {
byte zoom;
};
+void SetSelectionRed(bool);
+
/* viewport.c */
Point MapXYZToViewport(ViewPort *vp, uint x, uint y, uint z);
void AssignWindowViewport(Window *w, int x, int y,