summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-18 16:51:44 +0000
committerrubidium <rubidium@openttd.org>2008-05-18 16:51:44 +0000
commit9defec78767131d1dc9765c8943ae3bb165e8713 (patch)
tree4fbae4aa35ef120179cf9069c2eb93fa136ed7a2 /src
parentaab9e191f5612d0ddf309d8ec9de109218babd32 (diff)
downloadopenttd-9defec78767131d1dc9765c8943ae3bb165e8713.tar.xz
(svn r13165) -Codechange: replace some RebuildXXXList/ResortXXXList+InvalidateWindowXXX with InvalidateWindowXXXData.
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp7
-rw-r--r--src/economy.cpp5
-rw-r--r--src/group_gui.cpp4
-rw-r--r--src/order_cmd.cpp12
-rw-r--r--src/roadveh_cmd.cpp8
-rw-r--r--src/ship_cmd.cpp6
-rw-r--r--src/station.cpp3
-rw-r--r--src/station_cmd.cpp23
-rw-r--r--src/station_gui.cpp38
-rw-r--r--src/station_gui.h4
-rw-r--r--src/train_cmd.cpp12
-rw-r--r--src/train_gui.cpp3
-rw-r--r--src/vehicle.cpp2
-rw-r--r--src/vehicle_gui.cpp46
-rw-r--r--src/vehicle_gui.h2
-rw-r--r--src/water_cmd.cpp5
16 files changed, 53 insertions, 127 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 492689a07..cb89f172b 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -446,7 +446,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); //updates the replace Aircraft window
@@ -461,11 +461,10 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
static void DoDeleteAircraft(Vehicle *v)
{
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
- RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
DeleteDepotHighlightOfVehicle(v);
DeleteVehicleChain(v);
- InvalidateWindowClasses(WC_AIRCRAFT_LIST);
+ InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
}
/** Sell an aircraft.
@@ -656,7 +655,7 @@ CommandCost CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->cargo_subtype = new_subtype;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
}
return cost;
diff --git a/src/economy.cpp b/src/economy.cpp
index c7c2f2801..261e7b5c1 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1781,7 +1781,10 @@ static void DoAcquireCompany(Player *p)
p->is_active = false;
DeletePlayerWindows(pi);
- RebuildVehicleLists(); //Updates the open windows to add the newly acquired vehicles to the lists
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
+ InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
+ InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
+ InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
}
extern int GetAmountOwnedBy(const Player *p, PlayerID owner);
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 601cc2b0a..65c7959fb 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -286,8 +286,8 @@ struct VehicleGroupWindow : public Window, public VehicleListBase {
virtual void OnInvalidateData(int data)
{
- this->vehicles.flags |= VL_REBUILD;
- this->groups.flags |= VL_REBUILD;
+ this->vehicles.flags |= (data == 0 ? VL_REBUILD : VL_RESORT);
+ this->groups.flags |= (data == 0 ? VL_REBUILD : VL_RESORT);
if (!(IsAllGroupID(this->group_sel) || IsDefaultGroupID(this->group_sel) || IsValidGroupID(this->group_sel))) {
this->group_sel = ALL_GROUP;
HideDropDownMenu(this);
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 9d3cf3cab..f17db8306 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -546,7 +546,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
/* Make sure to rebuild the whole list */
- RebuildVehicleLists();
+ InvalidateWindowClassesData(GetWindowClassForVehicleType(v->type), 0);
}
return CommandCost();
@@ -561,7 +561,7 @@ static CommandCost DecloneOrder(Vehicle *dst, uint32 flags)
if (flags & DC_EXEC) {
DeleteVehicleOrders(dst);
InvalidateVehicleOrder(dst);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(GetWindowClassForVehicleType(dst->type), 0);
}
return CommandCost();
}
@@ -673,7 +673,7 @@ CommandCost CmdDeleteOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
cur_order_id++;
}
- RebuildVehicleLists();
+ InvalidateWindowClassesData(GetWindowClassForVehicleType(v->type), 0);
}
return CommandCost();
@@ -811,7 +811,7 @@ CommandCost CmdMoveOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
/* Make sure to rebuild the whole list */
- RebuildVehicleLists();
+ InvalidateWindowClassesData(GetWindowClassForVehicleType(v->type), 0);
}
return CommandCost();
@@ -1075,7 +1075,7 @@ CommandCost CmdCloneOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
InvalidateVehicleOrder(dst);
InvalidateVehicleOrder(src);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(GetWindowClassForVehicleType(dst->type), 0);
}
} break;
@@ -1134,7 +1134,7 @@ CommandCost CmdCloneOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
InvalidateVehicleOrder(dst);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(GetWindowClassForVehicleType(dst->type), 0);
}
} break;
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 5b8097080..0fe8d5a8a 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -280,7 +280,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
VehiclePositionChanged(v);
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Road window
@@ -381,7 +381,7 @@ CommandCost CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
// Invalidate depot
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner);
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
DeleteDepotHighlightOfVehicle(v);
@@ -574,7 +574,7 @@ static void DeleteLastRoadVeh(Vehicle *v)
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner);
if (IsTileType(v->tile, MP_STATION)) ClearCrashedStation(v);
@@ -2116,7 +2116,7 @@ CommandCost CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->cargo_subtype = new_subtype;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
}
if (only_this) break;
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index f1a7e9bc9..151277648 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -814,7 +814,7 @@ CommandCost CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
VehiclePositionChanged(v);
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Ship window
@@ -851,7 +851,7 @@ CommandCost CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner);
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
DeleteDepotHighlightOfVehicle(v);
@@ -997,7 +997,7 @@ CommandCost CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->cargo_subtype = new_subtype;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_SHIPS_LIST, 0);
}
return cost;
diff --git a/src/station.cpp b/src/station.cpp
index 8922a1fe3..355abb7ba 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -74,8 +74,7 @@ Station::~Station()
}
MarkDirty();
- RebuildStationLists();
- InvalidateWindowClasses(WC_STATION_LIST);
+ InvalidateWindowData(WC_STATION_LIST, this->owner, 0);
DeleteWindowById(WC_STATION_VIEW, index);
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index eb7054ec3..463f977f2 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -650,8 +650,7 @@ static void DeleteStationIfEmpty(Station *st)
{
if (st->facilities == 0) {
st->delete_ctr = 0;
- RebuildStationLists();
- InvalidateWindow(WC_STATION_LIST, st->owner);
+ InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
}
/* station remains but it probably lost some parts - station sign should stay in the station boundaries */
UpdateStationSignCoord(st);
@@ -1051,8 +1050,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
st->MarkTilesDirty(false);
UpdateStationVirtCoordDirty(st);
UpdateStationAcceptance(st, false);
- RebuildStationLists();
- InvalidateWindow(WC_STATION_LIST, st->owner);
+ InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_TRAINS);
}
@@ -1410,8 +1408,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
UpdateStationVirtCoordDirty(st);
UpdateStationAcceptance(st, false);
- RebuildStationLists();
- InvalidateWindow(WC_STATION_LIST, st->owner);
+ InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_ROADVEHS);
}
return cost;
@@ -1723,8 +1720,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
UpdateStationVirtCoordDirty(st);
UpdateStationAcceptance(st, false);
- RebuildStationLists();
- InvalidateWindow(WC_STATION_LIST, st->owner);
+ InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
}
@@ -1820,8 +1816,7 @@ CommandCost CmdBuildBuoy(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
UpdateStationVirtCoordDirty(st);
UpdateStationAcceptance(st, false);
- RebuildStationLists();
- InvalidateWindow(WC_STATION_LIST, st->owner);
+ InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS);
}
@@ -1979,8 +1974,7 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
UpdateStationVirtCoordDirty(st);
UpdateStationAcceptance(st, false);
- RebuildStationLists();
- InvalidateWindow(WC_STATION_LIST, st->owner);
+ InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_SHIPS);
}
@@ -2637,7 +2631,7 @@ CommandCost CmdRenameStation(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
st->name = strdup(_cmd_text);
UpdateStationVirtCoord(st);
- ResortStationLists();
+ InvalidateWindowData(WC_STATION_LIST, st->owner, 1);
MarkWholeScreenDirty();
}
@@ -2858,8 +2852,7 @@ static void ChangeTileOwner_Station(TileIndex tile, PlayerID old_player, PlayerI
SetTileOwner(tile, new_player);
if (!IsBuoy(tile)) st->owner = new_player; // do not set st->owner for buoys
- RebuildStationLists();
- InvalidateWindowClasses(WC_STATION_LIST);
+ InvalidateWindowClassesData(WC_STATION_LIST, 0);
} else {
if (IsDriveThroughStopTile(tile)) {
/* Remove the drive-through road stop */
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index 2e05722b4..d9535480c 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -168,39 +168,6 @@ static int CDECL StationRatingMaxSorter(const void *a, const void *b)
typedef GUIList<const Station*> GUIStationList;
/**
- * Set the station sort flag for all station-list windows.
- * @param sl_flag Sort list flag to set for all station-list windows
- */
-static void SetStationListsFlag(SortListFlags sl_flag)
-{
- Window *const *wz;
-
- FOR_ALL_WINDOWS(wz) {
- Window *w = *wz;
- if (w->window_class == WC_STATION_LIST) {
- dynamic_cast<GUIStationList*>(w)->flags |= sl_flag;
- w->SetDirty();
- }
- }
-}
-
-/**
- * Set the 'VL_REBUILD' flag for all station lists
- */
-void RebuildStationLists()
-{
- SetStationListsFlag(VL_REBUILD);
-}
-
-/**
- * Set the 'VL_RESORT' flag for all station lists
- */
-void ResortStationLists()
-{
- SetStationListsFlag(VL_RESORT);
-}
-
-/**
* Rebuild station list if the VL_REBUILD flag is set
*
* @param sl pointer to plstations_d (station list and flags)
@@ -605,6 +572,11 @@ struct PlayerStationsWindow : public Window, public GUIStationList
{
this->vscroll.cap += delta.y / 10;
}
+
+ virtual void OnInvalidateData(int data)
+ {
+ this->flags |= (data == 0 ? VL_REBUILD : VL_RESORT);
+ }
};
Listing PlayerStationsWindow::station_sort = {0, 0};
diff --git a/src/station_gui.h b/src/station_gui.h
index eddb7e249..316daf88c 100644
--- a/src/station_gui.h
+++ b/src/station_gui.h
@@ -48,10 +48,6 @@ enum StationViewWidgets {
SVW_RESIZE, ///< Resize button
};
-/* sorter stuff */
-void RebuildStationLists();
-void ResortStationLists();
-
enum StationCoverageType {
SCT_PASSENGERS_ONLY,
SCT_NON_PASSENGERS_ONLY,
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 146c33bc1..56bf2a9a7 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -803,7 +803,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
}
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer()) {
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Train window
@@ -1272,7 +1272,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p
InvalidateWindow(WC_VEHICLE_DEPOT, dst_head->tile);
}
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
}
return CommandCost();
@@ -1353,7 +1353,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
DeleteWindowById(WC_VEHICLE_VIEW, first->index);
}
InvalidateWindow(WC_VEHICLE_DEPOT, first->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
}
CommandCost cost(EXPENSES_NEW_VEHICLES);
@@ -2001,7 +2001,7 @@ CommandCost CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
v->cargo_subtype = new_subtype;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
}
}
}
@@ -2805,7 +2805,7 @@ static void SetVehicleCrashed(Vehicle *v)
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
}
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
BEGIN_ENUM_WAGONS(v)
v->vehstatus |= VS_CRASHED;
@@ -3152,7 +3152,7 @@ static void DeleteLastWagon(Vehicle *v)
}
}
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
MarkSingleVehicleDirty(v);
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 5e40583b7..d95d84dd6 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -18,6 +18,7 @@
#include "order_func.h"
#include "engine_func.h"
#include "engine_base.h"
+#include "window_func.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -43,7 +44,7 @@ void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2)
found = GetLastVehicleInChain(found);
/* put the new wagon at the end of the loco. */
DoCommandP(0, _new_vehicle_id | (found->index << 16), 0, NULL, CMD_MOVE_RAIL_VEHICLE);
- RebuildVehicleLists();
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
}
}
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index a4f8789a5..90354da3b 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1733,7 +1733,7 @@ CommandCost CmdNameVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
free(v->name);
v->name = strdup(_cmd_text);
- ResortVehicleLists();
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 1);
MarkWholeScreenDirty();
}
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 7fcd64b5b..c3a3c650a 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -86,47 +86,6 @@ const StringID _vehicle_sort_listing[] = {
INVALID_STRING_ID
};
-/**
- * Set sort list flag for all vehicle list windows
- * @param sl_flag Sort list flag to set
- */
-static void SetVehicleListsFlag(SortListFlags sl_flag)
-{
- Window* const *wz;
-
- FOR_ALL_WINDOWS(wz) {
- Window *w = *wz;
-
- switch (w->window_class) {
- case WC_TRAINS_LIST:
- case WC_ROADVEH_LIST:
- case WC_SHIPS_LIST:
- case WC_AIRCRAFT_LIST:
- dynamic_cast<VehicleListBase*>(w)->vehicles.flags |= sl_flag;
- w->SetDirty();
- break;
-
- default: break;
- }
- }
-}
-
-/**
- * Rebuild all vehicle list windows
- */
-void RebuildVehicleLists()
-{
- SetVehicleListsFlag(VL_REBUILD);
-}
-
-/**
- * Resort all vehicle list windows
- */
-void ResortVehicleLists()
-{
- SetVehicleListsFlag(VL_RESORT);
-}
-
void BuildVehicleList(VehicleListBase *vl, PlayerID owner, uint16 index, uint16 window_type)
{
if (!(vl->vehicles.flags & VL_REBUILD)) return;
@@ -1187,6 +1146,11 @@ struct VehicleListWindow : public Window, public VehicleListBase {
this->vscroll.cap += delta.y / (int)this->resize.step_height;
this->widget[VLW_WIDGET_LIST].data = (this->vscroll.cap << 8) + 1;
}
+
+ virtual void OnInvalidateData(int data)
+ {
+ this->vehicles.flags |= (data == 0 ? VL_REBUILD : VL_RESORT);
+ }
};
static const WindowDesc _player_vehicle_list_train_desc = {
diff --git a/src/vehicle_gui.h b/src/vehicle_gui.h
index b9ff7cf02..aea010a84 100644
--- a/src/vehicle_gui.h
+++ b/src/vehicle_gui.h
@@ -133,8 +133,6 @@ struct Sorting {
extern Sorting _sorting;
/* sorter stuff */
-void RebuildVehicleLists();
-void ResortVehicleLists();
void SortVehicleList(VehicleListBase *vl);
void BuildVehicleList(VehicleListBase *vl, PlayerID owner, uint16 index, uint16 window_type);
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 43813b60b..0f41878f2 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -838,20 +838,21 @@ static void FloodVehicle(Vehicle *v)
case VEH_TRAIN:
if (IsFrontEngine(v)) pass += 4; // driver
v->u.rail.crash_anim_pos = 4000; // max 4440, disappear pretty fast
+ InvalidateWindowClassesData(WC_TRAINS_LIST, 0);
break;
case VEH_ROAD:
if (IsRoadVehFront(v)) pass += 1; // driver
v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast
+ InvalidateWindowClassesData(WC_ROADVEH_LIST, 0);
break;
case VEH_AIRCRAFT:
pass += 2; // driver
v->u.air.crashed_counter = 9000; // max 10000, disappear pretty fast
+ InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
break;
}
-
- RebuildVehicleLists();
} else {
return;
}