summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-03-12 18:10:45 +0000
committersmatz <smatz@openttd.org>2008-03-12 18:10:45 +0000
commit9dade55b4af680a0653cde434f7a116eed7f102f (patch)
treef700545436b51714da4f903a4351a8a6ec1ba661
parentd74445134509b39db076b04e9ccfd7590028a5d2 (diff)
downloadopenttd-9dade55b4af680a0653cde434f7a116eed7f102f.tar.xz
(svn r12363) -Fix: do not allow building 'zero' road bits
-rw-r--r--src/road_cmd.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 356d11335..0f321dfb6 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -414,6 +414,9 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
RoadBits pieces = Extract<RoadBits, 0>(p1);
+ /* do not allow building 'zero' road bits, code wouldn't handle it */
+ if (pieces == ROAD_NONE) return CMD_ERROR;
+
RoadType rt = (RoadType)GB(p1, 4, 2);
if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;