| 935 | * --pasky */ |
| 936 | |
| 937 | static void HandleStationPlacement(TileIndex start, TileIndex end) |
| 938 | { |
| 939 | TileArea ta(start, end); |
| 940 | uint numtracks = ta.w; |
| 941 | uint platlength = ta.h; |
| 942 | |
| 943 | if (_station_gui.axis == AXIS_X) std::swap(numtracks, platlength); |
| 944 | |
| 945 | StationPickerSelection params = _station_gui; |
| 946 | RailType rt = _cur_railtype; |
| 947 | bool adjacent = _ctrl_pressed; |
| 948 | |
| 949 | auto proc = [=](bool test, StationID to_join) -> bool { |
| 950 | if (test) { |
| 951 | return Command<CMD_BUILD_RAIL_STATION>::Do(CommandFlagsToDCFlags(GetCommandFlags<CMD_BUILD_RAIL_STATION>()), ta.tile, rt, params.axis, numtracks, platlength, params.sel_class, params.sel_type, StationID::Invalid(), adjacent).Succeeded(); |
| 952 | } else { |
| 953 | return Command<CMD_BUILD_RAIL_STATION>::Post(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION, CcStation, ta.tile, rt, params.axis, numtracks, platlength, params.sel_class, params.sel_type, to_join, adjacent); |
| 954 | } |
| 955 | }; |
| 956 | |
| 957 | ShowSelectStationIfNeeded(ta, proc); |
| 958 | } |
| 959 | |
| 960 | /** |
| 961 | * Test if a station/waypoint uses the default graphics. |
no test coverage detected