* Place a new road stop. * @param start_tile First tile of the area. * @param end_tile Last tile of the area. * @param stop_type Type of stop (bus/truck). * @param adjacent Allow stations directly adjacent to other stations. * @param rt The roadtypes. * @param err_msg Error message to show. * @see CcRoadStop() */
| 227 | * @see CcRoadStop() |
| 228 | */ |
| 229 | static void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, RoadStopType stop_type, bool adjacent, RoadType rt, StringID err_msg) |
| 230 | { |
| 231 | TileArea ta(start_tile, end_tile); |
| 232 | DiagDirection ddir = _roadstop_gui.orientation; |
| 233 | bool drive_through = ddir >= DIAGDIR_END; |
| 234 | if (drive_through) ddir = static_cast<DiagDirection>(ddir - DIAGDIR_END); // Adjust picker result to actual direction. |
| 235 | RoadStopClassID spec_class = _roadstop_gui.sel_class; |
| 236 | uint16_t spec_index = _roadstop_gui.sel_type; |
| 237 | |
| 238 | auto proc = [=](bool test, StationID to_join) -> bool { |
| 239 | if (test) { |
| 240 | return Command<CMD_BUILD_ROAD_STOP>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_ROAD_STOP>()), ta.tile, ta.w, ta.h, stop_type, drive_through, |
| 241 | ddir, rt, spec_class, spec_index, StationID::Invalid(), adjacent).Succeeded(); |
| 242 | } else { |
| 243 | return Command<CMD_BUILD_ROAD_STOP>::Post(err_msg, CcRoadStop, ta.tile, ta.w, ta.h, stop_type, drive_through, |
| 244 | ddir, rt, spec_class, spec_index, to_join, adjacent); |
| 245 | } |
| 246 | }; |
| 247 | |
| 248 | ShowSelectStationIfNeeded(ta, proc); |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Place a road waypoint. |
no test coverage detected