From d452a0a0ecaad276c893b62ab8f008a5af85ba82 Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 21 Mar 2009 21:43:23 +0000 Subject: (svn r15789) -Codechange: Add DiagdirBetweenTiles() and use it. --- src/train_cmd.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/train_cmd.cpp') diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 29dab40b4..e5df3b9c4 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -3362,14 +3362,6 @@ static const Direction _new_vehicle_direction_table[11] = { DIR_E , DIR_SE, DIR_S }; -static inline Direction GetNewVehicleDirectionByTile(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); - return _new_vehicle_direction_table[offs]; -} - static inline int GetDirectionToVehicle(const Vehicle *v, int x, int y) { byte offs; @@ -3664,8 +3656,7 @@ static void TrainController(Vehicle *v, Vehicle *nomove) /* A new tile is about to be entered. */ /* Determine what direction we're entering the new tile from */ - Direction dir = GetNewVehicleDirectionByTile(gp.new_tile, gp.old_tile); - enterdir = DirToDiagDir(dir); + enterdir = DiagdirBetweenTiles(gp.old_tile, gp.new_tile); assert(IsValidDiagDirection(enterdir)); /* Get the status of the tracks in the new tile and mask -- cgit v1.2.3-54-g00ecf