1
0
Fork 0

(svn r21632) -Codechange: call ResetObjectToPlace() even when current place_mode is HT_NONE

release/1.1
smatz 2010-12-25 12:47:05 +00:00
parent b323000253
commit b5268dccbd
2 changed files with 10 additions and 13 deletions

View File

@ -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) void SetObjectToPlace(CursorID icon, PaletteID pal, HighLightStyle mode, WindowClass window_class, WindowNumber window_num)
{ {
/* undo clicking on button and drag & drop */ if (_thd.window_class != WC_INVALID) {
if ((_thd.place_mode & ~HT_DIR_MASK) != HT_NONE || _special_mouse_mode == WSM_DRAGDROP) { /* Undo clicking on button and drag & drop */
Window *w = FindWindowById(_thd.window_class, _thd.window_number); Window *w = FindWindowById(_thd.window_class, _thd.window_number);
if (w != NULL) { /* Call the abort function, but set the window class to something
/* Call the abort function, but set the window class to something * that will never be used to avoid infinite loops. Setting it to
* that will never be used to avoid infinite loops. Setting it to * the 'next' window class must not be done because recursion into
* the 'next' window class must not be done because recursion into * this function might in some cases reset the newly set object to
* this function might in some cases reset the newly set object to * place or not properly reset the original selection. */
* place or not properly reset the original selection. */ _thd.window_class = WC_INVALID;
_thd.window_class = WC_INVALID; if (w != NULL) w->OnPlaceObjectAbort();
w->OnPlaceObjectAbort();
}
} }
SetTileSelectSize(1, 1); SetTileSelectSize(1, 1);

View File

@ -653,8 +653,7 @@ void Window::DeleteChildWindows(WindowClass wc) const
*/ */
Window::~Window() Window::~Window()
{ {
if ((_thd.place_mode & ~HT_DIR_MASK) != HT_NONE && if (_thd.window_class == this->window_class &&
_thd.window_class == this->window_class &&
_thd.window_number == this->window_number) { _thd.window_number == this->window_number) {
ResetObjectToPlace(); ResetObjectToPlace();
} }