summaryrefslogtreecommitdiff
path: root/src/road_gui.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-15 14:41:56 +0000
committerrubidium <rubidium@openttd.org>2008-05-15 14:41:56 +0000
commit6d880ada7f8e9e43961f71db503f18da3cd5d6a3 (patch)
tree43c72cfecc28dfa3d1fafc35fe5d61d59367a67c /src/road_gui.cpp
parent31ab1e815a8f2af78bc1f17fa2e69b05e5806cd7 (diff)
downloadopenttd-6d880ada7f8e9e43961f71db503f18da3cd5d6a3.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/road_gui.cpp')
-rw-r--r--src/road_gui.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 216d6bc01..7016d4b43 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -511,12 +511,9 @@ static void BuildRoadToolbWndProc(Window *w, WindowEvent *e)
w->InvalidateWidget(RTW_REMOVE);
w->InvalidateWidget(RTW_ONE_WAY);
- w = FindWindowById(WC_BUS_STATION, 0);
- if (w != NULL) WP(w, def_d).close = true;
- w = FindWindowById(WC_TRUCK_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_BUS_STATION, 0);
+ delete FindWindowById(WC_TRUCK_STATION, 0);
+ delete FindWindowById(WC_BUILD_DEPOT, 0);
break;
case WE_PLACE_DRAG:
@@ -762,12 +759,8 @@ static void BuildRoadDepotWndProc(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;
default:
@@ -856,8 +849,6 @@ static void RoadStationPickerWndProc(Window *w, WindowEvent *e)
break;
case WE_PAINT: {
- if (WP(w, def_d).close) return;
-
DrawWindowWidgets(w);
if (_station_show_coverage) {
@@ -920,16 +911,11 @@ static void RoadStationPickerWndProc(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;
default: