(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().

replace/41b28d7194a279bdc17475d4fbe2ea6ec885a466
peter1138 19 years ago
parent 263741bf9b
commit 23b13d3f42

@ -986,9 +986,12 @@ static int RoadFindPathToDest(Vehicle *v, TileIndex tile, int enterdir)
} else if (IsTileType(tile, MP_STATION) && IsRoadStationTile(tile)) { } else if (IsTileType(tile, MP_STATION) && IsRoadStationTile(tile)) {
if (IsTileOwner(tile, v->owner)) { if (IsTileOwner(tile, v->owner)) {
/* Our station */ /* Our station */
const RoadStop *rs = GetRoadStopByTile(tile, (v->cargo_type == CT_PASSENGERS) ? RS_BUS : RS_TRUCK); RoadStopType rstype = (v->cargo_type == CT_PASSENGERS) ? RS_BUS : RS_TRUCK;
if (rs != NULL && (_patches.roadveh_queue || GB(rs->status, 0, 2) != 0)) { if (GetRoadStopType(tile) == rstype) {
bitmask |= _road_veh_fp_ax_or[GetRoadStationDir(tile)]; 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)];
}
} }
} }
} }

@ -196,7 +196,7 @@ uint GetStationPlatforms(const Station *st, TileIndex tile);
void StationPickerDrawSprite(int x, int y, RailType railtype, int image); void StationPickerDrawSprite(int x, int y, RailType railtype, int image);
RoadStop * GetRoadStopByTile(TileIndex tile, RoadStopType type); 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; return (_m[tile].m5 < 0x47) ? RS_TRUCK : RS_BUS;
} }

Loading…
Cancel
Save