diff options
author | rubidium <rubidium@openttd.org> | 2008-05-15 14:41:56 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-05-15 14:41:56 +0000 |
commit | 5ae795953afac677134e54f91a11436acb3c969d (patch) | |
tree | 43c72cfecc28dfa3d1fafc35fe5d61d59367a67c /src/dock_gui.cpp | |
parent | 8fff6e8638b848b129a3609ef22c0d0b611940e8 (diff) | |
download | openttd-5ae795953afac677134e54f91a11436acb3c969d.tar.xz |
(svn r13104) -Codechange: make ResetObjectToPlace safe to be called recursively via the OnPlaceObjectAbort callback and use this knowledge to simplify closing some windows.
Diffstat (limited to 'src/dock_gui.cpp')
-rw-r--r-- | src/dock_gui.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index e6369fdcf..c4bf10b42 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -175,11 +175,8 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e) case WE_ABORT_PLACE_OBJ: w->RaiseButtons(); - w = FindWindowById(WC_BUILD_STATION, 0); - if (w != NULL) WP(w, def_d).close = true; - - w = FindWindowById(WC_BUILD_DEPOT, 0); - if (w != NULL) WP(w, def_d).close = true; + delete FindWindowById(WC_BUILD_STATION, 0); + delete FindWindowById(WC_BUILD_DEPOT, 0); break; case WE_PLACE_PRESIZE: { @@ -241,7 +238,6 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e) case WE_PAINT: { int rad = (_patches.modified_catchment) ? CA_DOCK : CA_UNMODIFIED; - if (WP(w, def_d).close) return; DrawWindowWidgets(w); if (_station_show_coverage) { @@ -275,16 +271,11 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e) break; case WE_TICK: - if (WP(w, def_d).close) { - delete w; - return; - } - CheckRedrawStationCoverage(w); break; case WE_DESTROY: - if (!WP(w, def_d).close) ResetObjectToPlace(); + ResetObjectToPlace(); break; } } @@ -349,12 +340,8 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e) } } break; - case WE_TICK: - if (WP(w, def_d).close) delete w; - break; - case WE_DESTROY: - if (!WP(w, def_d).close) ResetObjectToPlace(); + ResetObjectToPlace(); break; } } |