summaryrefslogtreecommitdiff
path: root/roadveh_cmd.c
diff options
context:
space:
mode:
authormatthijs <matthijs@openttd.org>2005-05-02 23:59:11 +0000
committermatthijs <matthijs@openttd.org>2005-05-02 23:59:11 +0000
commit6eb094c72622b39bceff8293c3446e57d21c62f0 (patch)
treecad8daa1ee5542d4e8fefcbf2e2825e3f35fdb47 /roadveh_cmd.c
parent2ab5eee78b495ec73049c8446a0ed37ab4ff0920 (diff)
downloadopenttd-6eb094c72622b39bceff8293c3446e57d21c62f0.tar.xz
(svn r2256) - Fix: Trains cannot find a depot when they are in a tunnel. (glx)
- Add: GetVehicleTrackdir() helper function. - Codechange: Moved SortStruct from vehicle_gui.h to ttd.h, so the dependency from vehicle.h on vehicle_gui.h could be removed. - Codechange: Typedeffed the VehicleTypes struct so it can be used as the type for Vehicle.type instead of "byte". - Codechange: Removed prototype for VehicleSorter(), which had no implementation anymore and was never called.
Diffstat (limited to 'roadveh_cmd.c')
-rw-r--r--roadveh_cmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index b349bd8cc..670af9f6a 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -15,6 +15,7 @@
#include "player.h"
#include "sound.h"
#include "depot.h"
+#include "vehicle_gui.h"
void ShowRoadVehViewWindow(Vehicle *v);
@@ -316,7 +317,7 @@ static Depot *FindClosestRoadDepot(Vehicle *v)
* v->direction won't contain anything usefule than */
trackdir = _dir_to_diag_trackdir[GetRoadStationDir(tile)];
else
- trackdir = _dir_to_diag_trackdir[(v->direction>>1)&3];
+ trackdir = GetVehicleTrackdir(v);
ftd = NPFRouteToDepotBreadthFirst(v->tile, trackdir, TRANSPORT_ROAD, v->owner);
if (ftd.best_bird_dist == 0)
@@ -1160,7 +1161,8 @@ found_best_track:;
static uint RoadFindPathToStation(const Vehicle *v, TileIndex tile)
{
NPFFindStationOrTileData fstd;
- byte trackdir = _dir_to_diag_trackdir[(v->direction >> 1) & 3];
+ byte trackdir = GetVehicleTrackdir(v);
+ assert(trackdir != 0xFF);
fstd.dest_coords = tile;
fstd.station_index = -1; // indicates that the destination is a tile, not a station