(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
--- a/lang/english.txt Mon Jun 19 09:40:08 2006 +0000
+++ b/lang/english.txt Mon Jun 19 17:22:57 2006 +0000
@@ -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 Mon Jun 19 09:40:08 2006 +0000
+++ b/lang/german.txt Mon Jun 19 17:22:57 2006 +0000
@@ -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 Mon Jun 19 09:40:08 2006 +0000
+++ b/rail_cmd.c Mon Jun 19 17:22:57 2006 +0000
@@ -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 Mon Jun 19 09:40:08 2006 +0000
+++ b/road_cmd.c Mon Jun 19 17:22:57 2006 +0000
@@ -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 Mon Jun 19 09:40:08 2006 +0000
+++ b/tunnelbridge_cmd.c Mon Jun 19 17:22:57 2006 +0000
@@ -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;