Use separate tile hash for each vehicle type
This commit is contained in:
@@ -2015,8 +2015,6 @@ CommandCost CmdRemoveSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||
/** Update power of train under which is the railtype being converted */
|
||||
static Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data)
|
||||
{
|
||||
if (v->type != VEH_TRAIN) return nullptr;
|
||||
|
||||
TrainList *affected_trains = static_cast<TrainList*>(data);
|
||||
include(*affected_trains, Train::From(v)->First());
|
||||
|
||||
@@ -2148,7 +2146,7 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
|
||||
MarkTileDirtyByTile(tile, ZOOM_LVL_DRAW_MAP);
|
||||
/* update power of train on this tile */
|
||||
FindVehicleOnPos(tile, &affected_trains, &UpdateTrainPowerProc);
|
||||
FindVehicleOnPos(tile, VEH_TRAIN, &affected_trains, &UpdateTrainPowerProc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2224,8 +2222,8 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
SetSecondaryRailType(tile, totype);
|
||||
SetSecondaryRailType(endtile, totype);
|
||||
|
||||
FindVehicleOnPos(tile, &affected_trains, &UpdateTrainPowerProc);
|
||||
FindVehicleOnPos(endtile, &affected_trains, &UpdateTrainPowerProc);
|
||||
FindVehicleOnPos(tile, VEH_TRAIN, &affected_trains, &UpdateTrainPowerProc);
|
||||
FindVehicleOnPos(endtile, VEH_TRAIN, &affected_trains, &UpdateTrainPowerProc);
|
||||
|
||||
/* notify YAPF about the track layout change */
|
||||
yapf_notify_track_change(tile, GetTunnelBridgeTrackBits(tile));
|
||||
@@ -3808,7 +3806,7 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, int z_old
|
||||
*/
|
||||
static Vehicle *EnsureNoShipProc(Vehicle *v, void *data)
|
||||
{
|
||||
return v->type == VEH_SHIP ? v : nullptr;
|
||||
return v;
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
@@ -3821,7 +3819,7 @@ static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, int
|
||||
bool was_water = (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh_old));
|
||||
|
||||
/* Allow clearing the water only if there is no ship */
|
||||
if (was_water && HasVehicleOnPos(tile, nullptr, &EnsureNoShipProc)) return_cmd_error(STR_ERROR_SHIP_IN_THE_WAY);
|
||||
if (was_water && HasVehicleOnPos(tile, VEH_SHIP, nullptr, &EnsureNoShipProc)) return_cmd_error(STR_ERROR_SHIP_IN_THE_WAY);
|
||||
|
||||
if (was_water && _game_mode != GM_EDITOR && !_settings_game.construction.enable_remove_water && !(flags & DC_ALLOW_REMOVE_WATER)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
|
||||
|
||||
|
Reference in New Issue
Block a user