(svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
authortron
Wed, 29 Jun 2005 08:14:09 +0000
changeset 1990 efb67f977138
parent 1989 932e417e2efa
child 1991 4ce69ba880b4
(svn r2496) -Fix: [1179933] When toggling build/remove via keyboard the selection wasn't correctly redrawn
rail_gui.c
road_gui.c
viewport.c
viewport.h
--- a/rail_gui.c	Tue Jun 28 17:45:15 2005 +0000
+++ b/rail_gui.c	Wed Jun 29 08:14:09 2005 +0000
@@ -288,9 +288,9 @@
 	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) )
--- a/road_gui.c	Tue Jun 28 17:45:15 2005 +0000
+++ b/road_gui.c	Wed Jun 29 08:14:09 2005 +0000
@@ -159,8 +159,8 @@
 		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)
--- a/viewport.c	Tue Jun 28 17:45:15 2005 +0000
+++ b/viewport.c	Wed Jun 29 08:14:09 2005 +0000
@@ -1486,6 +1486,13 @@
 }
 
 
+void SetSelectionRed(bool b)
+{
+	_thd.make_square_red = b;
+	SetSelectionTilesDirty();
+}
+
+
 static bool CheckClickOnTown(ViewPort *vp, int x, int y)
 {
 	Town *t;
--- a/viewport.h	Tue Jun 28 17:45:15 2005 +0000
+++ b/viewport.h	Wed Jun 29 08:14:09 2005 +0000
@@ -11,6 +11,8 @@
 	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,