Mercurial > hg > openttd
changeset 4046:d51772e5aaba draft
(svn r5315) -Fix: Prohibit altering a road tile while road works are in progress
This fixes some glitches like "turning" the excavation by adding/removing road bits or removing the road piece
author | tron <tron@openttd.org> |
---|---|
date | Mon, 19 Jun 2006 17:22:57 +0000 |
parents | ee56e8a131e6 |
children | 47edbde39790 |
files | lang/english.txt lang/german.txt rail_cmd.c road_cmd.c tunnelbridge_cmd.c |
diffstat | 5 files changed, 17 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/lang/english.txt +++ b/lang/english.txt @@ -1499,6 +1499,7 @@ ##id 0x1800 STR_1801_MUST_REMOVE_ROAD_FIRST :{WHITE}Must remove road first +STR_ROAD_WORKS_IN_PROGRESS :{WHITE}Road works in progress STR_1802_ROAD_CONSTRUCTION :{WHITE}Road Construction STR_1803_SELECT_ROAD_BRIDGE :{WHITE}Select Road Bridge STR_1804_CAN_T_BUILD_ROAD_HERE :{WHITE}Can't build road here...
--- a/lang/german.txt +++ b/lang/german.txt @@ -1500,6 +1500,7 @@ ##id 0x1800 STR_1801_MUST_REMOVE_ROAD_FIRST :{WHITE}Straße muss erst entfernt werden +STR_ROAD_WORKS_IN_PROGRESS :{WHITE}Straßenarbeiten sind im Gange STR_1802_ROAD_CONSTRUCTION :{WHITE}Straßenbau STR_1803_SELECT_ROAD_BRIDGE :{WHITE}Brücke wählen STR_1804_CAN_T_BUILD_ROAD_HERE :{WHITE}Kann hier keine Straße bauen...
--- a/rail_cmd.c +++ b/rail_cmd.c @@ -286,12 +286,14 @@ if (!EnsureNoVehicle(tile)) return CMD_ERROR; - if (GetRoadTileType(tile) == ROAD_TILE_NORMAL && ( - (track == TRACK_X && GetRoadBits(tile) == ROAD_Y) || - (track == TRACK_Y && GetRoadBits(tile) == ROAD_X) - )) { - if (flags & DC_EXEC) { - MakeRoadCrossing(tile, GetTileOwner(tile), _current_player, (track == TRACK_X ? AXIS_Y : AXIS_X), p1, GetTownIndex(tile)); + if (GetRoadTileType(tile) == ROAD_TILE_NORMAL) { + if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS); + + if ((track == TRACK_X && GetRoadBits(tile) == ROAD_Y) || + (track == TRACK_Y && GetRoadBits(tile) == ROAD_X)) { + if (flags & DC_EXEC) { + MakeRoadCrossing(tile, GetTileOwner(tile), _current_player, (track == TRACK_X ? AXIS_Y : AXIS_X), p1, GetTownIndex(tile)); + } } break; }
--- a/road_cmd.c +++ b/road_cmd.c @@ -155,6 +155,8 @@ RoadBits present = GetRoadBits(tile); RoadBits c = pieces; + if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS); + if (GetTileSlope(tile, NULL) != SLOPE_FLAT && (present == ROAD_Y || present == ROAD_X)) { c |= (c & 0xC) >> 2; @@ -291,6 +293,8 @@ case MP_STREET: switch (GetRoadTileType(tile)) { case ROAD_TILE_NORMAL: + if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS); + existing = GetRoadBits(tile); if ((existing & pieces) == pieces) { return_cmd_error(STR_1007_ALREADY_BUILT);
--- a/tunnelbridge_cmd.c +++ b/tunnelbridge_cmd.c @@ -343,8 +343,9 @@ break; case MP_STREET: - if (GetRoadTileType(tile) != ROAD_TILE_NORMAL || - GetRoadBits(tile) != (direction == AXIS_X ? ROAD_Y : ROAD_X)) { + if (GetRoadTileType(tile) != ROAD_TILE_NORMAL) goto not_valid_below; + if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS); + if (GetRoadBits(tile) != (direction == AXIS_X ? ROAD_Y : ROAD_X)) { goto not_valid_below; } transport_under = TRANSPORT_ROAD;