(svn r20772) -Codechange: use packed VehicleListIdentifiers as window numbers

This commit is contained in:
rubidium
2010-09-08 21:37:13 +00:00
parent 881c6c679f
commit f5128695c5
11 changed files with 129 additions and 79 deletions

View File

@@ -16,6 +16,7 @@
#include "string_func.h"
#include "town.h"
#include "vehicle_gui.h"
#include "vehiclelist.h"
#include "window_func.h"
#include "table/strings.h"
@@ -71,13 +72,14 @@ CommandCost CmdRenameDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
SetWindowDirty(WC_VEHICLE_DEPOT, d->xy);
/* Update the depot list */
WindowNumber wno = (d->index << 16) | VLW_DEPOT_LIST | GetTileOwner(d->xy);
VehicleType vt;
switch (GetTileType(d->xy)) {
default: break;
case MP_RAILWAY: SetWindowDirty(WC_TRAINS_LIST, wno | (VEH_TRAIN << 11)); break;
case MP_ROAD: SetWindowDirty(WC_ROADVEH_LIST, wno | (VEH_ROAD << 11)); break;
case MP_WATER: SetWindowDirty(WC_SHIPS_LIST, wno | (VEH_SHIP << 11)); break;
default: NOT_REACHED();
case MP_RAILWAY: vt = VEH_TRAIN; break;
case MP_ROAD: vt = VEH_ROAD; break;
case MP_WATER: vt = VEH_SHIP; break;
}
SetWindowDirty(GetWindowClassForVehicleType(vt), VehicleListIdentifier(VL_DEPOT_LIST, vt, GetTileOwner(d->xy), d->index).Pack());
}
return CommandCost();
}