From 23b13d3f421d5013e2a3219ba6fa0fae9b5337d6 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Mon, 27 Feb 2006 19:43:19 +0000 Subject: (svn r3681) - [Multistop] Check the RoadStop type before check its status. This fixes an assert introduced in r3663. Also fix the return type of GetRoadStopType(). --- roadveh_cmd.c | 9 ++++++--- station.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/roadveh_cmd.c b/roadveh_cmd.c index dac75c3fb..84b9f9ab7 100644 --- a/roadveh_cmd.c +++ b/roadveh_cmd.c @@ -986,9 +986,12 @@ static int RoadFindPathToDest(Vehicle *v, TileIndex tile, int enterdir) } else if (IsTileType(tile, MP_STATION) && IsRoadStationTile(tile)) { if (IsTileOwner(tile, v->owner)) { /* Our station */ - const RoadStop *rs = GetRoadStopByTile(tile, (v->cargo_type == CT_PASSENGERS) ? RS_BUS : RS_TRUCK); - if (rs != NULL && (_patches.roadveh_queue || GB(rs->status, 0, 2) != 0)) { - bitmask |= _road_veh_fp_ax_or[GetRoadStationDir(tile)]; + RoadStopType rstype = (v->cargo_type == CT_PASSENGERS) ? RS_BUS : RS_TRUCK; + if (GetRoadStopType(tile) == rstype) { + const RoadStop *rs = GetRoadStopByTile(tile, rstype); + if (rs != NULL && (_patches.roadveh_queue || GB(rs->status, 0, 2) != 0)) { + bitmask |= _road_veh_fp_ax_or[GetRoadStationDir(tile)]; + } } } } diff --git a/station.h b/station.h index 53f6de5e2..54b8a6141 100644 --- a/station.h +++ b/station.h @@ -196,7 +196,7 @@ uint GetStationPlatforms(const Station *st, TileIndex tile); void StationPickerDrawSprite(int x, int y, RailType railtype, int image); RoadStop * GetRoadStopByTile(TileIndex tile, RoadStopType type); -static inline int GetRoadStopType(TileIndex tile) +static inline RoadStopType GetRoadStopType(TileIndex tile) { return (_m[tile].m5 < 0x47) ? RS_TRUCK : RS_BUS; } -- cgit v1.2.3-70-g09d2