(svn r13104) -Codechange: make ResetObjectToPlace safe to be called recursively via the OnPlaceObjectAbort callback and use this knowledge to simplify closing some windows.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user