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
commit902320d7cb79f0b75ea404dcdd3958519c28eaa7 (patch)
treef700545436b51714da4f903a4351a8a6ec1ba661
parent84385f187b2f8d99366a56fa57d487627056d315 (diff)
downloadopenttd-902320d7cb79f0b75ea404dcdd3958519c28eaa7.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;