mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(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
This commit is contained in:
parent
c61b617a16
commit
431baba8fe
@ -1499,6 +1499,7 @@ STR_RAILROAD_TRACK_WITH_COMBOSIGNALS :Railway track w
|
||||
|
||||
##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...
|
||||
|
@ -1500,6 +1500,7 @@ STR_RAILROAD_TRACK_WITH_COMBOSIGNALS :Gleis mit kombi
|
||||
|
||||
##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...
|
||||
|
14
rail_cmd.c
14
rail_cmd.c
@ -286,12 +286,14 @@ int32 CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -155,6 +155,8 @@ int32 CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
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 @@ int32 CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
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);
|
||||
|
@ -343,8 +343,9 @@ int32 CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user