From 661e13a86af45f88bc0fd7d8c045f66ceddd041e Mon Sep 17 00:00:00 2001 From: alberth Date: Thu, 30 Dec 2010 15:32:31 +0000 Subject: (svn r21667) -Codechange: Introduce _thd.Reset(). --- src/tilehighlight_type.h | 2 ++ src/viewport.cpp | 11 +++++++++++ src/window.cpp | 5 +---- 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/tilehighlight_type.h b/src/tilehighlight_type.h index 0e9ce8bc6..a37b97d97 100644 --- a/src/tilehighlight_type.h +++ b/src/tilehighlight_type.h @@ -74,6 +74,8 @@ struct TileHighlightData { ViewportPlaceMethod select_method; ///< The method which governs how tiles are selected. ViewportDragDropSelectionProcess select_proc; ///< The procedure that has to be called when the selection is done. + void Reset(); + bool IsDraggingDiagonal(); Window *GetCallbackWnd(); }; diff --git a/src/viewport.cpp b/src/viewport.cpp index e5e398eb8..f5848a1b9 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -2007,6 +2007,17 @@ static HighLightStyle GetAutorailHT(int x, int y) return HT_RAIL | _autorail_piece[x & TILE_UNIT_MASK][y & TILE_UNIT_MASK]; } +/** + * Reset tile highlighting. + */ +void TileHighlightData::Reset() +{ + this->pos.x = 0; + this->pos.y = 0; + this->new_pos.x = 0; + this->new_pos.y = 0; +} + /** * Is the user dragging a 'diagonal rectangle'? * @return User is dragging a rotated rectangle. diff --git a/src/window.cpp b/src/window.cpp index 3e601d212..4dca8403a 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -1366,10 +1366,7 @@ void ResetWindowSystem() { UnInitWindowSystem(); InitWindowSystem(); - _thd.pos.x = 0; - _thd.pos.y = 0; - _thd.new_pos.x = 0; - _thd.new_pos.y = 0; + _thd.Reset(); } static void DecreaseWindowCounters() -- cgit v1.2.3-54-g00ecf