mirror of https://github.com/OpenTTD/OpenTTD
(svn r11715) -Fix: do not use GetTrackBits() for depots and waypoints while converting railtype
parent
e9a039b845
commit
8e1f21e29b
|
@ -1227,21 +1227,38 @@ CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
switch (tt) {
|
switch (tt) {
|
||||||
case MP_RAILWAY:
|
case MP_RAILWAY:
|
||||||
if (flags & DC_EXEC) {
|
switch (GetRailTileType(tile)) {
|
||||||
/* notify YAPF about the track layout change */
|
case RAIL_TILE_WAYPOINT:
|
||||||
TrackBits tracks = GetTrackBits(tile);
|
if (flags & DC_EXEC) {
|
||||||
while (tracks != TRACK_BIT_NONE) {
|
/* notify YAPF about the track layout change */
|
||||||
YapfNotifyTrackLayoutChange(tile, RemoveFirstTrack(&tracks));
|
YapfNotifyTrackLayoutChange(tile, AxisToTrack(GetWaypointAxis(tile)));
|
||||||
}
|
}
|
||||||
|
cost.AddCost(RailConvertCost(type, totype));
|
||||||
|
break;
|
||||||
|
|
||||||
if (IsTileDepotType(tile, TRANSPORT_RAIL)) {
|
case RAIL_TILE_DEPOT:
|
||||||
/* Update build vehicle window related to this depot */
|
if (flags & DC_EXEC) {
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, tile);
|
/* notify YAPF about the track layout change */
|
||||||
InvalidateWindowData(WC_BUILD_VEHICLE, tile);
|
YapfNotifyTrackLayoutChange(tile, AxisToTrack(DiagDirToAxis(GetRailDepotDirection(tile))));
|
||||||
}
|
|
||||||
|
/* Update build vehicle window related to this depot */
|
||||||
|
InvalidateWindowData(WC_VEHICLE_DEPOT, tile);
|
||||||
|
InvalidateWindowData(WC_BUILD_VEHICLE, tile);
|
||||||
|
}
|
||||||
|
cost.AddCost(RailConvertCost(type, totype));
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // RAIL_TILE_NORMAL, RAIL_TILE_SIGNALS
|
||||||
|
if (flags & DC_EXEC) {
|
||||||
|
/* notify YAPF about the track layout change */
|
||||||
|
TrackBits tracks = GetTrackBits(tile);
|
||||||
|
while (tracks != TRACK_BIT_NONE) {
|
||||||
|
YapfNotifyTrackLayoutChange(tile, RemoveFirstTrack(&tracks));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cost.AddCost(RailConvertCost(type, totype) * CountBits(GetTrackBits(tile)));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cost.AddCost(CommandCost(RailConvertCost(type, totype) * CountBits(GetTrackBits(tile))));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_TUNNELBRIDGE: {
|
case MP_TUNNELBRIDGE: {
|
||||||
|
|
Loading…
Reference in New Issue