* Get the primary road stop (the first road stop) that the given vehicle can load/unload. * @param v the vehicle to get the first road stop for * @return the first roadstop that this vehicle can load at */
| 207 | * @return the first roadstop that this vehicle can load at |
| 208 | */ |
| 209 | RoadStop *Station::GetPrimaryRoadStop(const RoadVehicle *v) const |
| 210 | { |
| 211 | RoadStop *rs = this->GetPrimaryRoadStop(v->IsBus() ? RoadStopType::Bus : RoadStopType::Truck); |
| 212 | |
| 213 | for (; rs != nullptr; rs = rs->next) { |
| 214 | /* The vehicle cannot go to this roadstop (different roadtype) */ |
| 215 | if (!HasTileAnyRoadType(rs->xy, v->compatible_roadtypes)) continue; |
| 216 | /* The vehicle is articulated and can therefore not go to a standard road stop. */ |
| 217 | if (IsBayRoadStopTile(rs->xy) && v->HasArticulatedPart()) continue; |
| 218 | |
| 219 | /* The vehicle can actually go to this road stop. So, return it! */ |
| 220 | break; |
| 221 | } |
| 222 | |
| 223 | return rs; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Called when new facility is built on the station. If it is the first facility |
no test coverage detected