summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-06-19 17:22:57 +0000
committertron <tron@openttd.org>2006-06-19 17:22:57 +0000
commitd8605beacf9c9478f6db71c8f9f2e6b6646332aa (patch)
tree96b559696bd3fbcc26188de4966bf22e7a6d82cc
parentbba2109b228b40867a04290ab9986a8dd65ee07d (diff)
downloadopenttd-d8605beacf9c9478f6db71c8f9f2e6b6646332aa.tar.xz
(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
-rw-r--r--lang/english.txt1
-rw-r--r--lang/german.txt1
-rw-r--r--rail_cmd.c14
-rw-r--r--road_cmd.c4
-rw-r--r--tunnelbridge_cmd.c5
5 files changed, 17 insertions, 8 deletions
diff --git a/lang/english.txt b/lang/english.txt
index 71b4e46c2..30a1f5906 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -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...
diff --git a/lang/german.txt b/lang/german.txt
index ba2c5dca6..7d2e59b65 100644
--- a/lang/german.txt
+++ b/lang/german.txt
@@ -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...
diff --git a/rail_cmd.c b/rail_cmd.c
index eb4c4b79a..028c8592c 100644
--- a/rail_cmd.c
+++ b/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;
}
diff --git a/road_cmd.c b/road_cmd.c
index cd8263c31..7f99d6d0a 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -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);
diff --git a/tunnelbridge_cmd.c b/tunnelbridge_cmd.c
index 067db215b..b6034db69 100644
--- a/tunnelbridge_cmd.c
+++ b/tunnelbridge_cmd.c
@@ -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;