(svn r26104) -Fix: do not attempt to do stuff with an invalid direction, especially using it as index into a table

This commit is contained in:
rubidium 2013-11-25 13:13:35 +00:00
parent f817b06c18
commit c143ca729a
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}