diff options
author | smatz <smatz@openttd.org> | 2010-12-25 12:47:05 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2010-12-25 12:47:05 +0000 |
commit | b5268dccbd4da760b13114cebd44d371c3d84f56 (patch) | |
tree | d65d7da471afad3f38b26cec134b30b44c580228 /src/viewport.cpp | |
parent | b323000253a471b1a8553ad46bd9f107bea07d4d (diff) | |
download | openttd-b5268dccbd4da760b13114cebd44d371c3d84f56.tar.xz |
(svn r21632) -Codechange: call ResetObjectToPlace() even when current place_mode is HT_NONE
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r-- | src/viewport.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp index 7f3a5078e..ef78356c4 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -2839,18 +2839,16 @@ void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Wind void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num) { - /* undo clicking on button and drag & drop */ - if ((_thd.place_mode & ~HT_DIR_MASK) != HT_NONE || _special_mouse_mode == WSM_DRAGDROP) { + if (_thd.window_class != WC_INVALID) { + /* Undo clicking on button and drag & drop */ Window *w = FindWindowById(_thd.window_class, _thd.window_number); - if (w != NULL) { - /* Call the abort function, but set the window class to something - * that will never be used to avoid infinite loops. Setting it to - * the 'next' window class must not be done because recursion into - * this function might in some cases reset the newly set object to - * place or not properly reset the original selection. */ - _thd.window_class = WC_INVALID; - w->OnPlaceObjectAbort(); - } + /* Call the abort function, but set the window class to something + * that will never be used to avoid infinite loops. Setting it to + * the 'next' window class must not be done because recursion into + * this function might in some cases reset the newly set object to + * place or not properly reset the original selection. */ + _thd.window_class = WC_INVALID; + if (w != NULL) w->OnPlaceObjectAbort(); } SetTileSelectSize(1, 1); |