summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-11-25 13:13:35 +0000
committerrubidium <rubidium@openttd.org>2013-11-25 13:13:35 +0000
commitc143ca729a823f58cfa45aa2ea464d436b81d66b (patch)
treea4f68be1ea17aa1f35af639328e5853aad923a2c
parentf817b06c18dbded20fa01a0e38b81b4eefa7c1a6 (diff)
downloadopenttd-c143ca729a823f58cfa45aa2ea464d436b81d66b.tar.xz
(svn r26104) -Fix: do not attempt to do stuff with an invalid direction, especially using it as index into a table
-rw-r--r--src/town_cmd.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 4d5ce792a..b6cd19bc2 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1317,7 +1317,7 @@ static int GrowTownAtRoad(Town *t, TileIndex tile)
/* Exclude the source position from the bitmask
* and return if no more road blocks available */
- cur_rb &= ~DiagDirToRoadBits(ReverseDiagDir(target_dir));
+ if (IsValidDiagDirection(target_dir)) cur_rb &= ~DiagDirToRoadBits(ReverseDiagDir(target_dir));
if (cur_rb == ROAD_NONE) {
return _grow_town_result;
}