* Find a nearby waypoint that joins this waypoint. * @param existing_waypoint an existing waypoint we build over * @param waypoint_to_join the waypoint to join to * @param adjacent whether adjacent waypoints are allowed * @param ta the area of the newly build waypoint * @param wp 'return' pointer for the found waypoint * @param is_road whether to find a road waypoint * @return command cost
| 1314 | * @return command cost with the error or 'okay' |
| 1315 | */ |
| 1316 | CommandCost FindJoiningWaypoint(StationID existing_waypoint, StationID waypoint_to_join, bool adjacent, TileArea ta, Waypoint **wp, bool is_road) |
| 1317 | { |
| 1318 | if (is_road) { |
| 1319 | return FindJoiningBaseStation<Waypoint, STR_ERROR_MUST_REMOVE_ROADWAYPOINT_FIRST>(existing_waypoint, waypoint_to_join, adjacent, ta, wp, [](const Waypoint *wp) -> bool { return HasBit(wp->waypoint_flags, WPF_ROAD); }); |
| 1320 | } else { |
| 1321 | return FindJoiningBaseStation<Waypoint, STR_ERROR_MUST_REMOVE_RAILWAYPOINT_FIRST>(existing_waypoint, waypoint_to_join, adjacent, ta, wp, [](const Waypoint *wp) -> bool { return !HasBit(wp->waypoint_flags, WPF_ROAD); }); |
| 1322 | } |
| 1323 | } |
| 1324 | |
| 1325 | /** |
| 1326 | * Clear platform reservation during station building/removing. |
no test coverage detected