From c143ca729a823f58cfa45aa2ea464d436b81d66b Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 25 Nov 2013 13:13:35 +0000 Subject: [PATCH] (svn r26104) -Fix: do not attempt to do stuff with an invalid direction, especially using it as index into a table --- src/town_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 4d5ce792a1..b6cd19bc21 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; }