diff options
author | yexo <yexo@openttd.org> | 2012-09-21 20:28:23 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2012-09-21 20:28:23 +0000 |
commit | 6853df46c7d2867ef3c03a0b29ec8d33f060c696 (patch) | |
tree | 7210d44c66f9b9271ed0288f63be59c21b393952 /src | |
parent | d70ecf609c0adf7569c5bb9ca4d92114a07c0790 (diff) | |
download | openttd-6853df46c7d2867ef3c03a0b29ec8d33f060c696.tar.xz |
(svn r24539) -Codechange [FS#5260]: make code simpler by using IsValidTile instead of manually checking the bounds (juanjo)
Diffstat (limited to 'src')
-rw-r--r-- | src/ship_cmd.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index ae2c819db..9bf97fbd9 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -570,15 +570,12 @@ static void ShipController(Ship *v) } } } else { - DiagDirection diagdir; /* New tile */ - if (TileX(gp.new_tile) >= MapMaxX() || TileY(gp.new_tile) >= MapMaxY()) { - goto reverse_direction; - } + if (!IsValidTile(gp.new_tile)) goto reverse_direction; dir = ShipGetNewDirectionFromTiles(gp.new_tile, gp.old_tile); assert(dir == DIR_NE || dir == DIR_SE || dir == DIR_SW || dir == DIR_NW); - diagdir = DirToDiagDir(dir); + DiagDirection diagdir = DirToDiagDir(dir); tracks = GetAvailShipTracks(gp.new_tile, diagdir); if (tracks == TRACK_BIT_NONE) goto reverse_direction; |