(svn r6714) -Codechange: replaced a direct manipulation of windows with InvalidateWindowData() in rail_cmd.c

Moved the actual modification of railtype to WE_INVALIDATE_DATA in the train depot handler
-Codechange: added SetWindowDirty() to WE_INVALIDATE_DATA as it made no sense to update the list without making the window dirty
replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
bjarni 18 years ago
parent 13a0eb3ca6
commit 238b34e000

@ -548,6 +548,7 @@ static void NewAircraftWndProc(Window *w, WindowEvent *e)
case WE_INVALIDATE_DATA: case WE_INVALIDATE_DATA:
WP(w,buildvehicle_d).data_invalidated = true; WP(w,buildvehicle_d).data_invalidated = true;
SetWindowDirty(w);
break; break;
case WE_DESTROY: case WE_DESTROY:

@ -214,7 +214,6 @@ static void AcceptEnginePreview(Engine *e, PlayerID player)
e->preview_player = 0xFF; e->preview_player = 0xFF;
if (player == _local_player) { if (player == _local_player) {
InvalidateWindowClassesData(WC_BUILD_VEHICLE); InvalidateWindowClassesData(WC_BUILD_VEHICLE);
InvalidateWindowClasses(WC_BUILD_VEHICLE);
InvalidateWindowClasses(WC_REPLACE_VEHICLE); InvalidateWindowClasses(WC_REPLACE_VEHICLE);
} }
} }
@ -339,7 +338,6 @@ static void NewVehicleAvailable(Engine *e)
e->flags = (e->flags & ~ENGINE_INTRODUCING) | ENGINE_AVAILABLE; e->flags = (e->flags & ~ENGINE_INTRODUCING) | ENGINE_AVAILABLE;
InvalidateWindowClassesData(WC_BUILD_VEHICLE); InvalidateWindowClassesData(WC_BUILD_VEHICLE);
InvalidateWindowClasses(WC_BUILD_VEHICLE);
InvalidateWindowClasses(WC_REPLACE_VEHICLE); InvalidateWindowClasses(WC_REPLACE_VEHICLE);
// Now available for all players // Now available for all players

@ -888,14 +888,9 @@ static int32 DoConvertRail(TileIndex tile, RailType totype, bool exec)
if (IsTileDepotType(tile, TRANSPORT_RAIL)) { if (IsTileDepotType(tile, TRANSPORT_RAIL)) {
Vehicle *v; Vehicle *v;
Window *w;
/* Update build vehicle window related to this depot */ /* Update build vehicle window related to this depot */
w = FindWindowById(WC_BUILD_VEHICLE, tile); InvalidateWindowData(WC_BUILD_VEHICLE, tile);
if (w != NULL) {
WP(w,buildvehicle_d).railtype = totype;
SetWindowDirty(w);
}
/* update power of trains in this depot */ /* update power of trains in this depot */
FOR_ALL_VEHICLES(v) { FOR_ALL_VEHICLES(v) {

@ -546,7 +546,9 @@ static void NewRailVehicleWndProc(Window *w, WindowEvent *e)
break; break;
case WE_INVALIDATE_DATA: case WE_INVALIDATE_DATA:
if (w->window_number != 0) WP(w,buildvehicle_d).railtype = GetRailType(w->window_number);
WP(w,buildvehicle_d).data_invalidated = true; WP(w,buildvehicle_d).data_invalidated = true;
SetWindowDirty(w);
break; break;
case WE_DESTROY: case WE_DESTROY:

Loading…
Cancel
Save