# HG changeset patch # Parent c367174d77d68afeaee2fd7cb25c0cc6641bd769 diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -411,14 +411,6 @@ DIR_E , DIR_SE, DIR_S }; -static Direction ShipGetNewDirectionFromTiles(TileIndex new_tile, TileIndex old_tile) -{ - uint offs = (TileY(new_tile) - TileY(old_tile) + 1) * 4 + - TileX(new_tile) - TileX(old_tile) + 1; - assert(offs < 11 && offs != 3 && offs != 7); - return _new_vehicle_direction_table[offs]; -} - static Direction ShipGetNewDirection(Vehicle *v, int x, int y) { uint offs = (y - v->y_pos + 1) * 4 + (x - v->x_pos + 1); @@ -547,12 +539,10 @@ } else { /* New tile */ if (!IsValidTile(gp.new_tile)) goto reverse_direction; - DiagDirection diagdir; - - 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 = DiagdirBetweenTiles(gp.old_tile, gp.new_tile); + /* If ship reverses, there is no need for the assert included in old ShipGetNewDirectionFromTiles */ + /* Else, it will fall through and hit ShipGetNewDirection */ tracks = GetAvailShipTracks(gp.new_tile, diagdir); if (tracks == TRACK_BIT_NONE) goto reverse_direction;