diff options
author | frosch <frosch@openttd.org> | 2009-03-21 21:43:23 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2009-03-21 21:43:23 +0000 |
commit | d452a0a0ecaad276c893b62ab8f008a5af85ba82 (patch) | |
tree | 2816e5ec1ae12fd5f4cd0391c375c34b91225291 /src/train_cmd.cpp | |
parent | fd0f0bda721269e27950431db44886b309ef4596 (diff) | |
download | openttd-d452a0a0ecaad276c893b62ab8f008a5af85ba82.tar.xz |
(svn r15789) -Codechange: Add DiagdirBetweenTiles() and use it.
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r-- | src/train_cmd.cpp | 11 |
1 files changed, 1 insertions, 10 deletions
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 |