(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().
authorpeter1138
Mon, 27 Feb 2006 19:43:19 +0000
changeset 3092 e790a2dbda83
parent 3091 28de033d06b9
child 3093 f677403be64f
(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
station.h
--- a/roadveh_cmd.c	Mon Feb 27 17:24:31 2006 +0000
+++ b/roadveh_cmd.c	Mon Feb 27 19:43:19 2006 +0000
@@ -986,9 +986,12 @@
 	} 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)];
+				}
 			}
 		}
 	}
--- a/station.h	Mon Feb 27 17:24:31 2006 +0000
+++ b/station.h	Mon Feb 27 19:43:19 2006 +0000
@@ -196,7 +196,7 @@
 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;
 }