Use separate tile hash for each vehicle type

This commit is contained in:
Jonathan G Rennison
2020-02-28 22:21:10 +00:00
parent 4020719227
commit 4108672cf6
14 changed files with 227 additions and 221 deletions

View File

@@ -2479,8 +2479,6 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, int z
/** Update power of road vehicle under which is the roadtype being converted */
static Vehicle *UpdateRoadVehPowerProc(Vehicle *v, void *data)
{
if (v->type != VEH_ROAD) return nullptr;
RoadVehicleList *affected_rvs = static_cast<RoadVehicleList*>(data);
include(*affected_rvs, RoadVehicle::From(v)->First());
@@ -2637,7 +2635,7 @@ CommandCost CmdConvertRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
MarkTileDirtyByTile(tile);
/* update power of train on this tile */
FindVehicleOnPos(tile, &affected_rvs, &UpdateRoadVehPowerProc);
FindVehicleOnPos(tile, VEH_ROAD, &affected_rvs, &UpdateRoadVehPowerProc);
if (IsRoadDepotTile(tile)) {
/* Update build vehicle window related to this depot */
@@ -2710,8 +2708,8 @@ CommandCost CmdConvertRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
SetRoadType(tile, rtt, to_type);
if (include_middle) SetRoadType(endtile, rtt, to_type);
FindVehicleOnPos(tile, &affected_rvs, &UpdateRoadVehPowerProc);
FindVehicleOnPos(endtile, &affected_rvs, &UpdateRoadVehPowerProc);
FindVehicleOnPos(tile, VEH_ROAD, &affected_rvs, &UpdateRoadVehPowerProc);
FindVehicleOnPos(endtile, VEH_ROAD, &affected_rvs, &UpdateRoadVehPowerProc);
if (IsBridge(tile)) {
MarkBridgeDirty(tile);