--- a/lang/english.txt Wed Jun 21 19:39:54 2006 +0000
+++ b/lang/english.txt Sat Jun 24 09:12:15 2006 +0000
@@ -1450,6 +1450,7 @@
##id 0x1800
STR_1800_LAND_SLOPED_IN_WRONG_DIRECTION :{WHITE}Land sloped in wrong direction for road
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 Wed Jun 21 19:39:54 2006 +0000
+++ b/lang/german.txt Sat Jun 24 09:12:15 2006 +0000
@@ -1452,6 +1452,7 @@
##id 0x1800
STR_1800_LAND_SLOPED_IN_WRONG_DIRECTION :{WHITE}Das Land neigt sich in die falsche Richtung
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 Wed Jun 21 19:39:54 2006 +0000
+++ b/rail_cmd.c Sat Jun 24 09:12:15 2006 +0000
@@ -4,6 +4,7 @@
#include "openttd.h"
#include "debug.h"
#include "functions.h"
+#include "road_map.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "map.h"
@@ -344,6 +345,8 @@
(track == TRACK_DIAG1 && m5 == 0x05) ||
(track == TRACK_DIAG2 && m5 == 0x0A) // correct direction?
)) {
+ if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
+
if (flags & DC_EXEC) {
_m[tile].m3 = GetTileOwner(tile);
SetTileOwner(tile, _current_player);
--- a/road_cmd.c Wed Jun 21 19:39:54 2006 +0000
+++ b/road_cmd.c Sat Jun 24 09:12:15 2006 +0000
@@ -2,6 +2,7 @@
#include "stdafx.h"
#include "openttd.h"
+#include "road_map.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "functions.h"
@@ -210,6 +211,8 @@
if ((ti.map5 & 0xF0) == 0) { // normal road
byte c = pieces, t2;
+ if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
+
if (ti.tileh != 0 && (ti.map5 == 5 || ti.map5 == 10)) {
c |= (c & 0xC) >> 2;
c |= (c & 0x3) << 2;
@@ -372,6 +375,8 @@
if (ti.type == MP_STREET) {
if (!(ti.map5 & 0xF0)) {
+ if (HasRoadWorks(tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
+
if ((pieces & (byte)ti.map5) == pieces)
return_cmd_error(STR_1007_ALREADY_BUILT);
existing = ti.map5;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/road_map.h Sat Jun 24 09:12:15 2006 +0000
@@ -0,0 +1,43 @@
+/* $Id$ */
+
+#ifndef ROAD_MAP_H
+#define ROAD_MAP_H
+
+#include "macros.h"
+#include "tile.h"
+
+
+typedef enum RoadTileType {
+ ROAD_TILE_NORMAL,
+ ROAD_TILE_CROSSING,
+ ROAD_TILE_DEPOT
+} RoadTileType;
+
+static inline RoadTileType GetRoadTileType(TileIndex t)
+{
+ assert(IsTileType(t, MP_STREET));
+ return (RoadTileType)GB(_m[t].m5, 4, 4);
+}
+
+
+typedef enum Roadside {
+ ROADSIDE_BARREN = 0,
+ ROADSIDE_GRASS = 1,
+ ROADSIDE_PAVED = 2,
+ ROADSIDE_STREET_LIGHTS = 3,
+ ROADSIDE_TREES = 5,
+ ROADSIDE_GRASS_ROAD_WORKS = 6,
+ ROADSIDE_PAVED_ROAD_WORKS = 7
+} Roadside;
+
+static inline Roadside GetRoadside(TileIndex tile)
+{
+ return (Roadside)GB(_m[tile].m4, 4, 3);
+}
+
+static inline bool HasRoadWorks(TileIndex t)
+{
+ return GetRoadside(t) >= ROADSIDE_GRASS_ROAD_WORKS;
+}
+
+#endif
--- a/tunnelbridge_cmd.c Wed Jun 21 19:39:54 2006 +0000
+++ b/tunnelbridge_cmd.c Sat Jun 24 09:12:15 2006 +0000
@@ -8,6 +8,7 @@
#include "stdafx.h"
#include "openttd.h"
#include "bridge_map.h"
+#include "road_map.h"
#include "slope.h"
#include "table/sprites.h"
#include "table/strings.h"
@@ -354,6 +355,8 @@
}
m5 = 0xE0;
} else if (ti.type == MP_STREET) {
+ if (GetRoadTileType(ti.tile) != ROAD_TILE_NORMAL) goto not_valid_below;
+ if (HasRoadWorks(ti.tile)) return_cmd_error(STR_ROAD_WORKS_IN_PROGRESS);
if (direction == 0) {
if (ti.map5 != 5) goto not_valid_below;
} else {