1
0
Fork 0

(svn r3890) Simplify deleting a bridge by handling the ramps outside of the removal loop

release/0.5
tron 2006-03-15 17:38:00 +00:00
parent f262ae6c8b
commit b36203f671
1 changed files with 23 additions and 27 deletions

View File

@ -698,19 +698,17 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags)
}
if (flags & DC_EXEC) {
TileIndex c = tile;
TileIndexDiff delta = (direction == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
TileIndex c;
//checks if the owner is town then decrease town rating by RATING_TUNNEL_BRIDGE_DOWN_STEP until
// you have a "Poor" (0) town rating
if (IsTileOwner(tile, OWNER_TOWN) && _game_mode != GM_EDITOR)
ChangeTownRating(t, RATING_TUNNEL_BRIDGE_DOWN_STEP, RATING_TUNNEL_BRIDGE_MINIMUM);
do {
if (!(_m[c].m5 & 0x40)) {
// bridge ramp
DoClearSquare(c);
} else {
// bridge middle part
DoClearSquare(tile);
DoClearSquare(endtile);
for (c = tile + delta; c != endtile; c += delta) {
if (_m[c].m5 & 0x20) {
// transport under bridge
if (GB(_m[c].m5, 3, 2) == TRANSPORT_RAIL) {
@ -735,8 +733,6 @@ static int32 DoClearBridge(TileIndex tile, uint32 flags)
}
}
}
c += (direction == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
} while (c <= endtile);
SetSignalsOnBothDir(tile, direction == AXIS_X ? TRACK_X : TRACK_Y);
SetSignalsOnBothDir(endtile, direction == AXIS_X ? TRACK_X : TRACK_Y);