mirror of https://github.com/OpenTTD/OpenTTD
(svn r14314) -Fix: pay for two road bits when adding/removing roadtype at drive through road stop/level crossing
parent
856157b6da
commit
d5ca29a5ab
|
@ -255,7 +255,8 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cost.AddCost(_price.remove_road);
|
assert(IsDriveThroughStopTile(tile));
|
||||||
|
cost.AddCost(_price.remove_road * 2);
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
SetRoadTypes(tile, GetRoadTypes(tile) & ~RoadTypeToRoadTypes(rt));
|
SetRoadTypes(tile, GetRoadTypes(tile) & ~RoadTypeToRoadTypes(rt));
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
|
@ -525,6 +526,7 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
|
if (HasTileRoadType(tile, rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
|
||||||
other_bits = GetCrossingRoadBits(tile);
|
other_bits = GetCrossingRoadBits(tile);
|
||||||
if (pieces & ComplementRoadBits(other_bits)) goto do_clear;
|
if (pieces & ComplementRoadBits(other_bits)) goto do_clear;
|
||||||
|
pieces = other_bits; // we need to pay for both roadbits
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -577,7 +579,9 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
case MP_STATION:
|
case MP_STATION:
|
||||||
if (!IsRoadStop(tile)) goto do_clear;
|
if (!IsRoadStop(tile)) goto do_clear;
|
||||||
if (IsDriveThroughStopTile(tile)) {
|
if (IsDriveThroughStopTile(tile)) {
|
||||||
if (pieces & ~AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(tile)))) goto do_clear;
|
RoadBits curbits = AxisToRoadBits(DiagDirToAxis(GetRoadStopDir(tile)));
|
||||||
|
if (pieces & ~curbits) goto do_clear;
|
||||||
|
pieces = curbits; // we need to pay for both roadbits
|
||||||
} else {
|
} else {
|
||||||
if (pieces & ~DiagDirToRoadBits(GetRoadStopDir(tile))) goto do_clear;
|
if (pieces & ~DiagDirToRoadBits(GetRoadStopDir(tile))) goto do_clear;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue