diff --git a/gen_commands.py b/gen_commands.py index 50295eba95..9772103c07 100644 --- a/gen_commands.py +++ b/gen_commands.py @@ -1,3 +1,4 @@ +import glob import re from pathlib import Path from pprint import pprint @@ -5,6 +6,8 @@ from pprint import pprint RX_COMMAND = re.compile(r'(?PCommandCost|std::tuple]*>) (?PCmd\w*)\((?P[^)]*)\);') RX_DEF_TRAIT = re.compile(r'DEF_CMD_TRAIT\((?P\w+),\s+(?P\w+),\s+[^,]*,\s+(?P\w+)\)') RX_ARG = re.compile(r'(?P(:?const |)[\w:]* &?)(?P\w*)') +RX_CALLBACK = re.compile(r'void\s+(?PCc\w+)\(Commands') +RX_CALLBACK_REF = re.compile(r'CommandCallback\s+(?PCc\w+);') RX_CAMEL_TO_SNAKE = re.compile(r'(?; + +#ifdef SILENCE_GCC_FUNCTION_POINTER_CAST +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + +template +inline auto MakeCallbackTable(std::index_sequence) noexcept { + return std::array{{ reinterpret_cast(reinterpret_cast(std::get(_callback_tuple)))... }}; // MingW64 fails linking when casting a pointer to its own type. To work around, cast it to some other type first. +} +/** Type-erased table of callbacks. */ +static auto _callback_table = MakeCallbackTable(std::make_index_sequence<_callback_tuple_size>{});\n +template struct CallbackArgsHelper; +template +struct CallbackArgsHelper { + using Args = std::tuple...>; +}; +#ifdef SILENCE_GCC_FUNCTION_POINTER_CAST +# pragma GCC diagnostic pop +#endif + +static size_t FindCallbackIndex(CommandCallback *callback) { + if (auto it = std::find(std::cbegin(_callback_table), std::cend(_callback_table), callback); it != std::cend(_callback_table)) { + return static_cast(std::distance(std::cbegin(_callback_table), it)); + } + return std::numeric_limits::max(); +} + +template +bool _DoPost(StringID err_msg, TileIndex tile, Targs... args) { + return ::Command::Post(err_msg, std::get(_callback_tuple), tile, std::forward(args)...); +} +template +constexpr auto MakeCallback() noexcept { + /* Check if the callback matches with the command arguments. If not, don''t generate an Unpack proc. */ + using Tcallback = std::tuple_element_t; + if constexpr (std::is_same_v || + std::is_same_v || + std::is_same_v::CbArgs, typename CallbackArgsHelper::Args> || + (!std::is_void_v::RetTypes> && std::is_same_v::RetCallbackProc const>::Args, typename CallbackArgsHelper::Args>)) { + return &_DoPost; + } else { + return nullptr; + } +} + +''' def run(): - commands = parse_commands() + commands, includes, callbacks = parse_commands() with open(OUTPUT.with_suffix('.hpp'), 'w') as f: f.write( '// This file is generated by gen_commands.py, do not edit\n\n' '#ifndef CM_GEN_COMMANDS_HPP\n' '#define CM_GEN_COMMANDS_HPP\n' '#include "../cm_command_type.hpp"\n' + ) + for i in includes: + f.write(f'#include "../../{i}"\n') + f.write('\n') + f.write( 'namespace citymania {\n' 'namespace cmd {\n\n' ) @@ -71,21 +140,26 @@ def run(): ) for at, an in cmd['args']: f.write(f' {at}{an};\n') - f.write( - f'\n' - f' {name}({args_list})\n' - f' :{args_init} {{}}\n' - ) - if cmd.get('first_tile_arg'): + f.write(f'\n') + if args_init: f.write( - f' {name}(TileIndex tile, {args_list})\n' - f' :Command{{tile}}, {args_init} {{}}\n' + f' {name}({args_list})\n' + f' :{args_init} {{}}\n' + ) + else: + f.write(f' {name}({args_list}) {{}}\n') + + if cmd.get('first_tile_arg'): + separator = ', ' if args_list else '' + f.write( + f' {name}(TileIndex tile{separator}{args_list})\n' + f' :Command{{tile}}{separator}{args_init} {{}}\n' ) f.write( f' ~{name}() override {{}}\n' f'\n' - f' bool DoPost() override;\n' - f' bool DoTest() override;\n' + f' bool do_post(CommandCallback * callback) override;\n' + f' bool do_test() override;\n' f'}};\n\n' ) f.write( @@ -106,24 +180,51 @@ def run(): 'namespace citymania {\n' 'namespace cmd {\n\n' ) + f.write( + '/*\n' + ' * The code is mostly copied from network_command.cpp\n' + ' * but the table is not the same.\n' + ' */\n' + 'static constexpr auto _callback_tuple = std::make_tuple(\n' + ' (CommandCallback *)nullptr, // Make sure this is actually a pointer-to-function.\n' + ) + for i, cb in enumerate(callbacks): + comma = ',' if i != len(callbacks) - 1 else '' + f.write(f' &{cb}{comma}\n') + f.write(');\n\n') + f.write(CPP_TEMPLATES) + for cmd in commands: name = cmd['name'] constant = cmd['constant'] - # constant = 'CMD_' + RX_CAMEL_TO_SNAKE.sub('_', name).upper() - args_list = ', '.join(f'this->{an}' for _, an in cmd['args']) + this_args_list = ', '.join(f'this->{an}' for _, an in cmd['args']) + args_list = ', '.join(f'{an}' for _, an in cmd['args']) + args_type_list = ', '.join(f'{at}' for at, an in cmd['args']) test_args_list = args_list if cmd.get('first_tile_arg'): - test_args_list = f'this->tile, ' + args_list + if args_list: + test_args_list = f'this->tile, ' + args_list + else: + test_args_list = f'this->tile' cost_getter = '' if cmd['returns'] is None else 'std::get<0>' - + sep_args_list = sep_args_type_list = sep_this_args_list = '' + if args_list: + sep_args_list = ', ' + args_list + sep_args_type_list = ', ' + args_type_list + sep_this_args_list = ', ' + this_args_list f.write( - f'bool {name}::DoPost() {{\n' - f' return ::Command<{constant}>::Post(this->error, this->tile, {args_list});\n' + f'' + 'template \n' + f'inline constexpr auto MakeDispatchTable{name}(std::index_sequence) noexcept\n' + '{\n' + f' return std::array{{MakeCallback<{constant}, i{sep_args_type_list}>()... }};\n' '}\n' - ) - f.write( - f'bool {name}::DoTest() {{\n' + f'static constexpr auto _{name}_dispatch = MakeDispatchTable{name}(std::make_index_sequence<_callback_tuple_size>{{}});\n' + f'bool {name}::do_post(CommandCallback *callback) {{\n' + f' return _{name}_dispatch[FindCallbackIndex(callback)](this->error, this->tile{sep_this_args_list});\n' + '}\n' + f'bool {name}::do_test() {{\n' f' return {cost_getter}(::Command<{constant}>::Do(DC_NONE, {test_args_list})).Succeeded();\n' '}\n' ) diff --git a/grf/alpine/alpine.py b/grf/alpine/alpine.py index 2c79216265..f31c65e468 100644 --- a/grf/alpine/alpine.py +++ b/grf/alpine/alpine.py @@ -7,6 +7,8 @@ gen = grf.NewGRF( grfid=b'CMAL', name='CityMania Alpine Landscape', description='Modified OpenGFX sprites for alpine climate.', + version=2, + min_compatible_version=0, ) @@ -352,8 +354,9 @@ for i in range(81): gen.add(layout := grf.AdvancedSpriteLayout( feature=grf.OBJECT, ground={ - 'sprite': grf.SpriteRef(4550, is_global=True), + 'sprite': grf.SpriteRef(0, is_global=True), 'flags': 2, + 'add': grf.Temp(1), }, buildings=[{ 'sprite': grf.SpriteRef(i, is_global=False), @@ -363,7 +366,6 @@ for i in range(81): )) gen.add(layout_switch := grf.Switch( - feature=grf.OBJECT, ranges={0: layout}, default=layout, code=f''' diff --git a/grf/alpine/gen_sprites.py b/grf/alpine/gen_sprites.py index d2cd4175cf..10c74d7a6b 100644 --- a/grf/alpine/gen_sprites.py +++ b/grf/alpine/gen_sprites.py @@ -3,6 +3,7 @@ import numpy as np import math import os +import random import spectra import grf @@ -305,6 +306,10 @@ for i in range (81): # if not inp: # continue + for ii in inp: + for oo in outp: + xy = ((edges[ii][0] + xx, edges[ii][1] + yy), (edges[oo][0] + xx, edges[oo][1] + yy)) + draw_bezier(imd2, 0x38, 5, xy[0], center, xy[1]) for ii in inp: for oo in outp: xy = ((edges[ii][0] + xx, edges[ii][1] + yy), (edges[oo][0] + xx, edges[oo][1] + yy)) @@ -340,4 +345,14 @@ for i in range (81): # dout[oy + y + 64 * i, ox + x] = find_best_color(c) # im2 = Image.fromarray(dout) # im2.putpalette(im.getpalette()) +# +px = im2.load() +for y in range(im2.height): + for x in range(im2.width): + if px[x, y] == 0xF5: + px[x, y] = random.randint(0xF5, 0xF9) + elif px[x, y] == 0x42: + px[x, y] = random.randint(0x10, 0x14) + elif px[x, y] == 0x38: + px[x, y] = random.randint(0x19, 0x1e) im2.save(os.path.join(DEST_DIR, "rivers.png")) diff --git a/grf/alpine/gfx/rivers.png b/grf/alpine/gfx/rivers.png index c3f3648b05..deaa3aa84e 100644 Binary files a/grf/alpine/gfx/rivers.png and b/grf/alpine/gfx/rivers.png differ diff --git a/src/citymania/cm_blueprint.cpp b/src/citymania/cm_blueprint.cpp index ade545292c..8a3355db77 100644 --- a/src/citymania/cm_blueprint.cpp +++ b/src/citymania/cm_blueprint.cpp @@ -215,14 +215,14 @@ std::multimap Blueprint::GetTiles(TileIndex tile std::set can_build_station_sign; for (auto &item: this->items) { if (item.type != Item::Type::RAIL_STATION) continue; - if (GetBlueprintCommand(tile, item)->Test()) + if (GetBlueprintCommand(tile, item)->test()) can_build_station_sign.insert(item.u.rail.station.id); } for (auto &o: this->items) { auto otile = AddTileIndexDiffCWrap(tile, o.tdiff); auto palette = CM_PALETTE_TINT_WHITE; - if (o.type != Item::Type::RAIL_SIGNAL && !GetBlueprintCommand(tile, o)->Test()) + if (o.type != Item::Type::RAIL_SIGNAL && !GetBlueprintCommand(tile, o)->test()) palette = CM_PALETTE_TINT_RED_DEEP; switch(o.type) { @@ -600,7 +600,7 @@ void BuildBlueprint(sp &blueprint, TileIndex start) { case Blueprint::Item::Type::RAIL_TUNNEL: case Blueprint::Item::Type::RAIL_BRIDGE: { auto cc = GetBlueprintCommand(start, item); - cc->Post(); + cc->post(); if (item.type == Blueprint::Item::Type::RAIL_TRACK) last_rail = std::move(cc); break; } @@ -634,7 +634,7 @@ void BuildBlueprint(sp &blueprint, TileIndex start) { for (auto &item : blueprint->items) { if (item.type != Blueprint::Item::Type::RAIL_SIGNAL) continue; auto cc = GetBlueprintCommand(start, item); - cc->Post(); + cc->post(); } return true; }; diff --git a/src/citymania/cm_command_type.hpp b/src/citymania/cm_command_type.hpp index 1aa344daea..8e1d5d7bbc 100644 --- a/src/citymania/cm_command_type.hpp +++ b/src/citymania/cm_command_type.hpp @@ -3,13 +3,21 @@ #include "../bridge.h" #include "../command_func.h" +#include "../depot_type.h" +#include "../goal_type.h" +#include "../group_cmd.h" +#include "../engine_type.h" +#include "../livery.h" #include "../misc_cmd.h" +#include "../news_type.h" #include "../object_type.h" #include "../order_type.h" #include "../road_type.h" #include "../road_type.h" #include "../station_type.h" +#include "../story_type.h" #include "../track_type.h" +#include "../vehiclelist.h" enum StationClassID : byte; @@ -19,50 +27,56 @@ class Command { public: TileIndex tile = 0; bool automatic = false; - CompanyID as_company = INVALID_COMPANY; + CompanyID company = INVALID_COMPANY; StringID error = (StringID)0; Command() {} Command(TileIndex tile) :tile{tile} {} virtual ~Command() {} - virtual bool DoPost()=0; - virtual bool DoTest()=0; - bool Post() { + virtual bool do_post(CommandCallback *callback)=0; + virtual bool do_test()=0; + + template + bool post(Tcallback callback) { CompanyID old = _current_company; - if (this->as_company != INVALID_COMPANY) - _current_company = as_company; - bool res = this->DoPost(); + if (this->company != INVALID_COMPANY) + _current_company = company; + bool res = this->do_post(reinterpret_cast(reinterpret_cast(callback))); _current_company = old; return res; } - bool Test() { + bool post() { + return this->post(nullptr); + } + + bool test() { CompanyID old = _current_company; - if (this->as_company != INVALID_COMPANY) - _current_company = as_company; - bool res = this->DoTest(); + if (this->company != INVALID_COMPANY) + _current_company = company; + bool res = this->do_test(); _current_company = old; return res; } - Command &WithTile(TileIndex tile) { + Command &with_tile(TileIndex tile) { this->tile = tile; return *this; } - Command &WithError(StringID error) { + Command &with_error(StringID error) { this->error = error; return *this; } - Command &SetAuto() { + Command &set_auto() { this->automatic = true; return *this; } - Command &AsCompany(CompanyID company) { - this->as_company = company; + Command &as_company(CompanyID company) { + this->company = company; return *this; } }; diff --git a/src/citymania/cm_console_cmds.cpp b/src/citymania/cm_console_cmds.cpp index a771ec19c6..b311054e69 100644 --- a/src/citymania/cm_console_cmds.cpp +++ b/src/citymania/cm_console_cmds.cpp @@ -55,7 +55,7 @@ bool ConStep(byte argc, char *argv[]) { auto n = (argc > 1 ? atoi(argv[1]) : 1); // FIXME (n << 1) - cmd::Pause(PM_PAUSED_NORMAL, 0).Post(); + cmd::Pause(PM_PAUSED_NORMAL, 0).post(); return true; } diff --git a/src/citymania/cm_highlight.cpp b/src/citymania/cm_highlight.cpp index df7944e425..d5a9e8b46e 100644 --- a/src/citymania/cm_highlight.cpp +++ b/src/citymania/cm_highlight.cpp @@ -329,7 +329,7 @@ void ObjectHighlight::UpdateTiles() { this->tile, _cur_railtype, dir - ).Test() ? CM_PALETTE_TINT_WHITE : CM_PALETTE_TINT_RED_DEEP); + ).test() ? CM_PALETTE_TINT_WHITE : CM_PALETTE_TINT_RED_DEEP); this->tiles.insert(std::make_pair(this->tile, ObjectTileHighlight::make_rail_depot(palette, dir))); auto tile = this->tile + TileOffsByDiagDir(dir); @@ -356,7 +356,7 @@ void ObjectHighlight::UpdateTiles() { _railstation.station_type, NEW_STATION, true - ).Test() ? CM_PALETTE_TINT_WHITE : CM_PALETTE_TINT_RED_DEEP); + ).test() ? CM_PALETTE_TINT_WHITE : CM_PALETTE_TINT_RED_DEEP); auto layout_ptr = AllocaM(byte, (int)numtracks * plat_len); GetStationLayout(layout_ptr, numtracks, plat_len, nullptr); // TODO statspec @@ -388,7 +388,7 @@ void ObjectHighlight::UpdateTiles() { this->roadtype, NEW_STATION, true - ).Test() ? CM_PALETTE_TINT_WHITE : CM_PALETTE_TINT_RED_DEEP); + ).test() ? CM_PALETTE_TINT_WHITE : CM_PALETTE_TINT_RED_DEEP); for (TileIndex tile : ta) { this->AddTile(tile, ObjectTileHighlight::make_road_stop(palette, this->roadtype, this->ddir, this->is_truck)); } @@ -400,7 +400,7 @@ void ObjectHighlight::UpdateTiles() { this->tile, this->roadtype, this->ddir - ).Test() ? CM_PALETTE_TINT_WHITE : CM_PALETTE_TINT_RED_DEEP); + ).test() ? CM_PALETTE_TINT_WHITE : CM_PALETTE_TINT_RED_DEEP); this->AddTile(this->tile, ObjectTileHighlight::make_road_depot(palette, this->roadtype, this->ddir)); break; } @@ -412,7 +412,7 @@ void ObjectHighlight::UpdateTiles() { this->airport_layout, NEW_STATION, true - ).Test() ? CM_PALETTE_TINT_WHITE : CM_PALETTE_TINT_RED_DEEP); + ).test() ? CM_PALETTE_TINT_WHITE : CM_PALETTE_TINT_RED_DEEP); const AirportSpec *as = AirportSpec::Get(this->airport_type); if (!as->IsAvailable() || this->airport_layout >= as->num_table) break; diff --git a/src/citymania/cm_station_gui.cpp b/src/citymania/cm_station_gui.cpp index fc1049a7b4..f6cb78ef0b 100644 --- a/src/citymania/cm_station_gui.cpp +++ b/src/citymania/cm_station_gui.cpp @@ -3,6 +3,7 @@ #include "cm_station_gui.hpp" #include "cm_hotkeys.hpp" +#include "cm_commands.hpp" #include "../core/math_func.hpp" #include "../command_type.h" @@ -189,7 +190,6 @@ const Station *CheckClickOnDeadStationSign() { } bool CheckStationJoin(TileIndex start_tile, TileIndex end_tile) { - // if (_ctrl_pressed && start_tile == end_tile) { if (citymania::_fn_mod) { if (IsTileType (start_tile, MP_STATION)) { citymania::SelectStationToJoin(Station::GetByTile(start_tile)); @@ -204,18 +204,19 @@ bool CheckStationJoin(TileIndex start_tile, TileIndex end_tile) { return false; } -using JoinAndBuildCmdProc = std::function; +// using JoinAndBuildCmdProc = std::function; -void JoinAndBuild(JoinAndBuildCmdProc proc) { +template +void JoinAndBuild(Tcommand command, Tcallback *callback) { auto join_to = _highlight_station_to_join; - bool adjacent = (citymania::_fn_mod || join_to); - StationID to_join = INVALID_STATION; + command.adjacent = (citymania::_fn_mod || join_to); + command.station_to_join = INVALID_STATION; - if (citymania::_fn_mod) to_join = NEW_STATION; - else if (join_to) to_join = join_to->index; + if (citymania::_fn_mod) command.station_to_join = NEW_STATION; + else if (join_to) command.station_to_join = join_to->index; //FIXME _last_station_bulid_cmd = cmdcont; - proc(false, to_join, adjacent); + command.post(callback); } static DiagDirection TileFractCoordsToDiagDir(Point pt) { @@ -341,24 +342,30 @@ DiagDirection AutodetectDriveThroughRoadStopDirection(TileArea area, Point pt, R return DiagDirToAxis(AutodetectRoadObjectDirection(area.tile, pt, roadtype)) == AXIS_X ? STATIONDIR_X : STATIONDIR_Y; } -void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, uint32 p2, uint32 cmd) { +void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, RoadStopType stop_type, bool adjacent, RoadType rt, StringID err_msg) { assert(_thd.cm.type == citymania::ObjectHighlight::Type::ROAD_STOP); - uint8 ddir = _thd.cm.ddir; + DiagDirection ddir = _thd.cm.ddir; - SB(p2, 16, 16, INVALID_STATION); // no station to join TileArea ta(start_tile, end_tile); if (CheckStationJoin(start_tile, end_tile)) return; - if (ddir >= DIAGDIR_END) { // drive-through stops - SetBit(p2, 1); - ddir -= DIAGDIR_END; - } - p2 |= ddir << 3; // Set the DiagDirecion into p2 bits 3 and 4. + bool drive_through = (ddir >= DIAGDIR_END); + if (drive_through) ddir = static_cast(ddir - DIAGDIR_END); // Adjust picker result to actual direction. - // FIXME - // CommandContainer cmdcont = { ta.tile, (uint32)(ta.w | ta.h << 8), p2, cmd, CcRoadStop, "" }; - // JoinAndBuild(cmdcont); + auto c = cmd::BuildRoadStop( + ta.tile, + ta.w, + ta.h, + stop_type, + drive_through, + static_cast(ddir), + rt, + INVALID_STATION, + adjacent + ); + c.with_error(err_msg); + JoinAndBuild(c, CcRoadStop); } void HandleStationPlacement(TileIndex start, TileIndex end) @@ -371,47 +378,51 @@ void HandleStationPlacement(TileIndex start, TileIndex end) if (_railstation.orientation == AXIS_X) Swap(numtracks, platlength); - uint32 p1 = _cur_railtype | _railstation.orientation << 6 | numtracks << 8 | platlength << 16 | (citymania::_fn_mod ? 1 << 24 : 0); - uint32 p2 = _railstation.station_class | _railstation.station_type << 8 | INVALID_STATION << 16; - - // FIXME - // CommandContainer cmdcont = { ta.tile, p1, p2, CMD_BUILD_RAIL_STATION | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION), CcStation, "" }; - // JoinAndBuild(cmdcont); + auto c = cmd::BuildRailStation( + ta.tile, + _cur_railtype, + _railstation.orientation, + numtracks, + platlength, + _railstation.station_class, + _railstation.station_type, + INVALID_STATION, + false + ); + c.with_error(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION); + JoinAndBuild(c, CcStation); } void PlaceRail_Station(TileIndex tile) { if (CheckStationJoin(tile, tile)) return; - - uint32 p1 = _cur_railtype | _railstation.orientation << 6 | _settings_client.gui.station_numtracks << 8 | _settings_client.gui.station_platlength << 16 | (citymania::_fn_mod ? 1 << 24 : 0); - uint32 p2 = _railstation.station_class | _railstation.station_type << 8 | INVALID_STATION << 16; - - int w = _settings_client.gui.station_numtracks; - int h = _settings_client.gui.station_platlength; - if (!_railstation.orientation) Swap(w, h); - - // FIXME - // CommandContainer cmdcont = { tile, p1, p2, CMD_BUILD_RAIL_STATION | CMD_MSG(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION), CcStation, "" }; - // JoinAndBuild(cmdcont); + auto c = cmd::BuildRailStation( + tile, + _cur_railtype, + _railstation.orientation, + _settings_client.gui.station_numtracks, + _settings_client.gui.station_platlength, + _railstation.station_class, + _railstation.station_type, + INVALID_STATION, + false + ); + c.with_error(STR_ERROR_CAN_T_BUILD_RAILROAD_STATION); + JoinAndBuild(c, CcStation); } -void PlaceDock(TileIndex tile) { - if (CheckStationJoin(tile, tile)) return; +void PlaceDock(TileIndex tile, TileIndex tile_to) { + if (CheckStationJoin(tile, tile_to)) return; - uint32 p2 = (uint32)INVALID_STATION << 16; // no station to join - - /* tile is always the land tile, so need to evaluate _thd.pos */ - // CommandContainer cmdcont = { tile, citymania::_fn_mod, p2, CMD_BUILD_DOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_DOCK_HERE), CcBuildDocks, "" }; - - /* Determine the watery part of the dock. */ - // DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile)); - // TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile); - - // FIXME - // JoinAndBuild(cmdcont); + auto c = cmd::BuildDock( + tile, + INVALID_STATION, + false + ); + c.with_error(STR_ERROR_CAN_T_BUILD_DOCK_HERE); + JoinAndBuild(c, CcBuildDocks); } void PlaceAirport(TileIndex tile) { - // FIXME if (CheckStationJoin(tile, tile)) return; if (_selected_airport_index == -1) return; @@ -419,15 +430,15 @@ void PlaceAirport(TileIndex tile) { byte airport_type = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index)->GetIndex(); byte layout = _selected_airport_layout; - auto proc = [=](bool test, StationID to_join, bool adjacent) -> bool { - if (test) { - return Command::Do(CommandFlagsToDCFlags(GetCommandFlags()), tile, airport_type, layout, INVALID_STATION, adjacent).Succeeded(); - } else { - return Command::Post(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE, CcBuildAirport, tile, airport_type, layout, to_join, adjacent); - } - }; - - // FIXME JoinAndBuild(cmdcont); + auto c = cmd::BuildAirport( + tile, + airport_type, + layout, + INVALID_STATION, + false + ); + c.with_error(STR_ERROR_CAN_T_BUILD_AIRPORT_HERE); + JoinAndBuild(c, CcBuildAirport); } static void FindStationsAroundSelection(const TileArea &location) diff --git a/src/citymania/cm_station_gui.hpp b/src/citymania/cm_station_gui.hpp index 2befe59735..908cd352ea 100644 --- a/src/citymania/cm_station_gui.hpp +++ b/src/citymania/cm_station_gui.hpp @@ -27,10 +27,10 @@ enum class StationBuildingStatus { bool UseImprovedStationJoin(); void OnStationTileSetChange(const Station *station, bool adding, StationType type); void OnStationPartBuilt(const Station *station, TileIndex tile, uint32 p1, uint32 p2); -void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, uint32 p2, uint32 cmd); +void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, RoadStopType stop_type, bool adjacent, RoadType rt, StringID err_msg); void HandleStationPlacement(TileIndex start, TileIndex end); void PlaceRail_Station(TileIndex tile); -void PlaceDock(TileIndex tile); +void PlaceDock(TileIndex tile, TileIndex tile_to); void PlaceAirport(TileIndex tile); void SelectStationToJoin(const Station *station); diff --git a/src/citymania/generated/cm_gen_commands.cpp b/src/citymania/generated/cm_gen_commands.cpp index de5b43d69e..5e56a61a2f 100644 --- a/src/citymania/generated/cm_gen_commands.cpp +++ b/src/citymania/generated/cm_gen_commands.cpp @@ -13,347 +13,1761 @@ namespace citymania { namespace cmd { -bool MoneyCheat::DoPost() { - return ::Command::Post(this->error, this->tile, this->amount); +/* + * The code is mostly copied from network_command.cpp + * but the table is not the same. + */ +static constexpr auto _callback_tuple = std::make_tuple( + (CommandCallback *)nullptr, // Make sure this is actually a pointer-to-function. + &CcBuildDocks, + &CcPlaySound_CONSTRUCTION_WATER, + &CcBuildPrimaryVehicle, + &CcStartStopVehicle, + &CcCreateGroup, + &CcAddVehicleNewGroup, + &CcBuildAirport, + &CcCloneVehicle, + &CcRoadDepot, + &CcRoadStop, + &CcPlaySound_CONSTRUCTION_OTHER, + &CcBuildRoadTunnel, + &CcRailDepot, + &CcPlaySound_CONSTRUCTION_RAIL, + &CcStation, + &CcBuildRailTunnel, + &CcBuildIndustry, + &CcFoundRandomTown, + &CcFoundTown, + &CcBuildWagon, + &CcPlaceSign, + &CcBuildBridge, + &CcTerraform, + &CcPlaySound_EXPLOSION +); + +inline constexpr size_t _callback_tuple_size = std::tuple_size_v; + +#ifdef SILENCE_GCC_FUNCTION_POINTER_CAST +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wcast-function-type" +#endif + +template +inline auto MakeCallbackTable(std::index_sequence) noexcept { + return std::array{{ reinterpret_cast(reinterpret_cast(std::get(_callback_tuple)))... }}; // MingW64 fails linking when casting a pointer to its own type. To work around, cast it to some other type first. } -bool MoneyCheat::DoTest() { - return (::Command::Do(DC_NONE, this->amount)).Succeeded(); +/** Type-erased table of callbacks. */ +static auto _callback_table = MakeCallbackTable(std::make_index_sequence<_callback_tuple_size>{}); + +template struct CallbackArgsHelper; +template +struct CallbackArgsHelper { + using Args = std::tuple...>; +}; +#ifdef SILENCE_GCC_FUNCTION_POINTER_CAST +# pragma GCC diagnostic pop +#endif + +static size_t FindCallbackIndex(CommandCallback *callback) { + if (auto it = std::find(std::cbegin(_callback_table), std::cend(_callback_table), callback); it != std::cend(_callback_table)) { + return static_cast(std::distance(std::cbegin(_callback_table), it)); + } + return std::numeric_limits::max(); } -bool ChangeBankBalance::DoPost() { - return ::Command::Post(this->error, this->tile, this->delta, this->company, this->expenses_type); +template +bool _DoPost(StringID err_msg, TileIndex tile, Targs... args) { + return ::Command::Post(err_msg, std::get(_callback_tuple), tile, std::forward(args)...); } -bool ChangeBankBalance::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->delta, this->company, this->expenses_type)).Succeeded(); +template +constexpr auto MakeCallback() noexcept { + /* Check if the callback matches with the command arguments. If not, don''t generate an Unpack proc. */ + using Tcallback = std::tuple_element_t; + if constexpr (std::is_same_v || + std::is_same_v || + std::is_same_v::CbArgs, typename CallbackArgsHelper::Args> || + (!std::is_void_v::RetTypes> && std::is_same_v::RetCallbackProc const>::Args, typename CallbackArgsHelper::Args>)) { + return &_DoPost; + } else { + return nullptr; + } } -bool IncreaseLoan::DoPost() { - return ::Command::Post(this->error, this->tile, this->cmd, this->amount); +template +inline constexpr auto MakeDispatchTableCreateGoal(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool IncreaseLoan::DoTest() { - return (::Command::Do(DC_NONE, this->cmd, this->amount)).Succeeded(); +static constexpr auto _CreateGoal_dispatch = MakeDispatchTableCreateGoal(std::make_index_sequence<_callback_tuple_size>{}); +bool CreateGoal::do_post(CommandCallback *callback) { + return _CreateGoal_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->company, this->type, this->dest, this->text); +} +bool CreateGoal::do_test() { + return std::get<0>(::Command::Do(DC_NONE, company, type, dest, text)).Succeeded(); } -bool DecreaseLoan::DoPost() { - return ::Command::Post(this->error, this->tile, this->cmd, this->amount); +template +inline constexpr auto MakeDispatchTableRemoveGoal(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool DecreaseLoan::DoTest() { - return (::Command::Do(DC_NONE, this->cmd, this->amount)).Succeeded(); +static constexpr auto _RemoveGoal_dispatch = MakeDispatchTableRemoveGoal(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveGoal::do_post(CommandCallback *callback) { + return _RemoveGoal_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->goal); +} +bool RemoveGoal::do_test() { + return (::Command::Do(DC_NONE, goal)).Succeeded(); } -bool Pause::DoPost() { - return ::Command::Post(this->error, this->tile, this->mode, this->pause); +template +inline constexpr auto MakeDispatchTableSetGoalText(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool Pause::DoTest() { - return (::Command::Do(DC_NONE, this->mode, this->pause)).Succeeded(); +static constexpr auto _SetGoalText_dispatch = MakeDispatchTableSetGoalText(std::make_index_sequence<_callback_tuple_size>{}); +bool SetGoalText::do_post(CommandCallback *callback) { + return _SetGoalText_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->goal, this->text); +} +bool SetGoalText::do_test() { + return (::Command::Do(DC_NONE, goal, text)).Succeeded(); } -bool BuildObject::DoPost() { - return ::Command::Post(this->error, this->tile, this->type, this->view); +template +inline constexpr auto MakeDispatchTableSetGoalProgress(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildObject::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->type, this->view)).Succeeded(); +static constexpr auto _SetGoalProgress_dispatch = MakeDispatchTableSetGoalProgress(std::make_index_sequence<_callback_tuple_size>{}); +bool SetGoalProgress::do_post(CommandCallback *callback) { + return _SetGoalProgress_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->goal, this->text); +} +bool SetGoalProgress::do_test() { + return (::Command::Do(DC_NONE, goal, text)).Succeeded(); } -bool BuildObjectArea::DoPost() { - return ::Command::Post(this->error, this->tile, this->start_tile, this->type, this->view, this->diagonal); +template +inline constexpr auto MakeDispatchTableSetGoalCompleted(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildObjectArea::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->start_tile, this->type, this->view, this->diagonal)).Succeeded(); +static constexpr auto _SetGoalCompleted_dispatch = MakeDispatchTableSetGoalCompleted(std::make_index_sequence<_callback_tuple_size>{}); +bool SetGoalCompleted::do_post(CommandCallback *callback) { + return _SetGoalCompleted_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->goal, this->completed); +} +bool SetGoalCompleted::do_test() { + return (::Command::Do(DC_NONE, goal, completed)).Succeeded(); } -bool ModifyOrder::DoPost() { - return ::Command::Post(this->error, this->tile, this->veh, this->sel_ord, this->mof, this->data); +template +inline constexpr auto MakeDispatchTableGoalQuestion(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool ModifyOrder::DoTest() { - return (::Command::Do(DC_NONE, this->veh, this->sel_ord, this->mof, this->data)).Succeeded(); +static constexpr auto _GoalQuestion_dispatch = MakeDispatchTableGoalQuestion(std::make_index_sequence<_callback_tuple_size>{}); +bool GoalQuestion::do_post(CommandCallback *callback) { + return _GoalQuestion_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->uniqueid, this->target, this->is_client, this->button_mask, this->type, this->text); +} +bool GoalQuestion::do_test() { + return (::Command::Do(DC_NONE, uniqueid, target, is_client, button_mask, type, text)).Succeeded(); } -bool SkipToOrder::DoPost() { - return ::Command::Post(this->error, this->tile, this->veh_id, this->sel_ord); +template +inline constexpr auto MakeDispatchTableGoalQuestionAnswer(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool SkipToOrder::DoTest() { - return (::Command::Do(DC_NONE, this->veh_id, this->sel_ord)).Succeeded(); +static constexpr auto _GoalQuestionAnswer_dispatch = MakeDispatchTableGoalQuestionAnswer(std::make_index_sequence<_callback_tuple_size>{}); +bool GoalQuestionAnswer::do_post(CommandCallback *callback) { + return _GoalQuestionAnswer_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->uniqueid, this->button); +} +bool GoalQuestionAnswer::do_test() { + return (::Command::Do(DC_NONE, uniqueid, button)).Succeeded(); } -bool DeleteOrder::DoPost() { - return ::Command::Post(this->error, this->tile, this->veh_id, this->sel_ord); +template +inline constexpr auto MakeDispatchTableCustomNewsItem(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool DeleteOrder::DoTest() { - return (::Command::Do(DC_NONE, this->veh_id, this->sel_ord)).Succeeded(); +static constexpr auto _CustomNewsItem_dispatch = MakeDispatchTableCustomNewsItem(std::make_index_sequence<_callback_tuple_size>{}); +bool CustomNewsItem::do_post(CommandCallback *callback) { + return _CustomNewsItem_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->type, this->reftype1, this->company, this->reference, this->text); +} +bool CustomNewsItem::do_test() { + return (::Command::Do(DC_NONE, type, reftype1, company, reference, text)).Succeeded(); } -bool InsertOrder::DoPost() { - return ::Command::Post(this->error, this->tile, this->veh, this->sel_ord, this->new_order); +template +inline constexpr auto MakeDispatchTableCreateStoryPage(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool InsertOrder::DoTest() { - return (::Command::Do(DC_NONE, this->veh, this->sel_ord, this->new_order)).Succeeded(); +static constexpr auto _CreateStoryPage_dispatch = MakeDispatchTableCreateStoryPage(std::make_index_sequence<_callback_tuple_size>{}); +bool CreateStoryPage::do_post(CommandCallback *callback) { + return _CreateStoryPage_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->company, this->text); +} +bool CreateStoryPage::do_test() { + return std::get<0>(::Command::Do(DC_NONE, company, text)).Succeeded(); } -bool OrderRefit::DoPost() { - return ::Command::Post(this->error, this->tile, this->veh, this->order_number, this->cargo); +template +inline constexpr auto MakeDispatchTableCreateStoryPageElement(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool OrderRefit::DoTest() { - return (::Command::Do(DC_NONE, this->veh, this->order_number, this->cargo)).Succeeded(); +static constexpr auto _CreateStoryPageElement_dispatch = MakeDispatchTableCreateStoryPageElement(std::make_index_sequence<_callback_tuple_size>{}); +bool CreateStoryPageElement::do_post(CommandCallback *callback) { + return _CreateStoryPageElement_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->page_id, this->type, this->reference, this->text); +} +bool CreateStoryPageElement::do_test() { + return std::get<0>(::Command::Do(DC_NONE, this->tile, page_id, type, reference, text)).Succeeded(); } -bool CloneOrder::DoPost() { - return ::Command::Post(this->error, this->tile, this->action, this->veh_dst, this->veh_src); +template +inline constexpr auto MakeDispatchTableUpdateStoryPageElement(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool CloneOrder::DoTest() { - return (::Command::Do(DC_NONE, this->action, this->veh_dst, this->veh_src)).Succeeded(); +static constexpr auto _UpdateStoryPageElement_dispatch = MakeDispatchTableUpdateStoryPageElement(std::make_index_sequence<_callback_tuple_size>{}); +bool UpdateStoryPageElement::do_post(CommandCallback *callback) { + return _UpdateStoryPageElement_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->page_element_id, this->reference, this->text); +} +bool UpdateStoryPageElement::do_test() { + return (::Command::Do(DC_NONE, this->tile, page_element_id, reference, text)).Succeeded(); } -bool MoveOrder::DoPost() { - return ::Command::Post(this->error, this->tile, this->veh, this->moving_order, this->target_order); +template +inline constexpr auto MakeDispatchTableSetStoryPageTitle(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool MoveOrder::DoTest() { - return (::Command::Do(DC_NONE, this->veh, this->moving_order, this->target_order)).Succeeded(); +static constexpr auto _SetStoryPageTitle_dispatch = MakeDispatchTableSetStoryPageTitle(std::make_index_sequence<_callback_tuple_size>{}); +bool SetStoryPageTitle::do_post(CommandCallback *callback) { + return _SetStoryPageTitle_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->page_id, this->text); +} +bool SetStoryPageTitle::do_test() { + return (::Command::Do(DC_NONE, page_id, text)).Succeeded(); } -bool ClearOrderBackup::DoPost() { - return ::Command::Post(this->error, this->tile, this->user_id); +template +inline constexpr auto MakeDispatchTableSetStoryPageDate(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool ClearOrderBackup::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->user_id)).Succeeded(); +static constexpr auto _SetStoryPageDate_dispatch = MakeDispatchTableSetStoryPageDate(std::make_index_sequence<_callback_tuple_size>{}); +bool SetStoryPageDate::do_post(CommandCallback *callback) { + return _SetStoryPageDate_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->page_id, this->date); +} +bool SetStoryPageDate::do_test() { + return (::Command::Do(DC_NONE, page_id, date)).Succeeded(); } -bool BuildRailroadTrack::DoPost() { - return ::Command::Post(this->error, this->tile, this->start_tile, this->railtype, this->track, this->auto_remove_signals, this->fail_on_obstacle); +template +inline constexpr auto MakeDispatchTableShowStoryPage(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildRailroadTrack::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->start_tile, this->railtype, this->track, this->auto_remove_signals, this->fail_on_obstacle)).Succeeded(); +static constexpr auto _ShowStoryPage_dispatch = MakeDispatchTableShowStoryPage(std::make_index_sequence<_callback_tuple_size>{}); +bool ShowStoryPage::do_post(CommandCallback *callback) { + return _ShowStoryPage_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->page_id); +} +bool ShowStoryPage::do_test() { + return (::Command::Do(DC_NONE, page_id)).Succeeded(); } -bool RemoveRailroadTrack::DoPost() { - return ::Command::Post(this->error, this->tile, this->start_tile, this->track); +template +inline constexpr auto MakeDispatchTableRemoveStoryPage(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool RemoveRailroadTrack::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->start_tile, this->track)).Succeeded(); +static constexpr auto _RemoveStoryPage_dispatch = MakeDispatchTableRemoveStoryPage(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveStoryPage::do_post(CommandCallback *callback) { + return _RemoveStoryPage_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->page_id); +} +bool RemoveStoryPage::do_test() { + return (::Command::Do(DC_NONE, page_id)).Succeeded(); } -bool BuildSingleRail::DoPost() { - return ::Command::Post(this->error, this->tile, this->railtype, this->track, this->auto_remove_signals); +template +inline constexpr auto MakeDispatchTableRemoveStoryPageElement(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildSingleRail::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->railtype, this->track, this->auto_remove_signals)).Succeeded(); +static constexpr auto _RemoveStoryPageElement_dispatch = MakeDispatchTableRemoveStoryPageElement(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveStoryPageElement::do_post(CommandCallback *callback) { + return _RemoveStoryPageElement_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->page_element_id); +} +bool RemoveStoryPageElement::do_test() { + return (::Command::Do(DC_NONE, page_element_id)).Succeeded(); } -bool RemoveSingleRail::DoPost() { - return ::Command::Post(this->error, this->tile, this->track); +template +inline constexpr auto MakeDispatchTableStoryPageButton(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool RemoveSingleRail::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->track)).Succeeded(); +static constexpr auto _StoryPageButton_dispatch = MakeDispatchTableStoryPageButton(std::make_index_sequence<_callback_tuple_size>{}); +bool StoryPageButton::do_post(CommandCallback *callback) { + return _StoryPageButton_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->page_element_id, this->reference); +} +bool StoryPageButton::do_test() { + return (::Command::Do(DC_NONE, this->tile, page_element_id, reference)).Succeeded(); } -bool BuildTrainDepot::DoPost() { - return ::Command::Post(this->error, this->tile, this->railtype, this->dir); +template +inline constexpr auto MakeDispatchTableBuildVehicle(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildTrainDepot::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->railtype, this->dir)).Succeeded(); +static constexpr auto _BuildVehicle_dispatch = MakeDispatchTableBuildVehicle(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildVehicle::do_post(CommandCallback *callback) { + return _BuildVehicle_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->eid, this->use_free_vehicles, this->cargo, this->client_id); +} +bool BuildVehicle::do_test() { + return std::get<0>(::Command::Do(DC_NONE, this->tile, eid, use_free_vehicles, cargo, client_id)).Succeeded(); } -bool BuildSingleSignal::DoPost() { - return ::Command::Post(this->error, this->tile, this->track, this->sigtype, this->sigvar, this->convert_signal, this->skip_existing_signals, this->ctrl_pressed, this->cycle_start, this->cycle_stop, this->num_dir_cycle, this->signals_copy); +template +inline constexpr auto MakeDispatchTableSellVehicle(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildSingleSignal::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->track, this->sigtype, this->sigvar, this->convert_signal, this->skip_existing_signals, this->ctrl_pressed, this->cycle_start, this->cycle_stop, this->num_dir_cycle, this->signals_copy)).Succeeded(); +static constexpr auto _SellVehicle_dispatch = MakeDispatchTableSellVehicle(std::make_index_sequence<_callback_tuple_size>{}); +bool SellVehicle::do_post(CommandCallback *callback) { + return _SellVehicle_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->v_id, this->sell_chain, this->backup_order, this->client_id); +} +bool SellVehicle::do_test() { + return (::Command::Do(DC_NONE, v_id, sell_chain, backup_order, client_id)).Succeeded(); } -bool RemoveSingleSignal::DoPost() { - return ::Command::Post(this->error, this->tile, this->track); +template +inline constexpr auto MakeDispatchTableRefitVehicle(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool RemoveSingleSignal::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->track)).Succeeded(); +static constexpr auto _RefitVehicle_dispatch = MakeDispatchTableRefitVehicle(std::make_index_sequence<_callback_tuple_size>{}); +bool RefitVehicle::do_post(CommandCallback *callback) { + return _RefitVehicle_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id, this->new_cid, this->new_subtype, this->auto_refit, this->only_this, this->num_vehicles); +} +bool RefitVehicle::do_test() { + return std::get<0>(::Command::Do(DC_NONE, veh_id, new_cid, new_subtype, auto_refit, only_this, num_vehicles)).Succeeded(); } -bool ConvertRail::DoPost() { - return ::Command::Post(this->error, this->tile, this->area_start, this->totype, this->diagonal); +template +inline constexpr auto MakeDispatchTableSendVehicleToDepot(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool ConvertRail::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->area_start, this->totype, this->diagonal)).Succeeded(); +static constexpr auto _SendVehicleToDepot_dispatch = MakeDispatchTableSendVehicleToDepot(std::make_index_sequence<_callback_tuple_size>{}); +bool SendVehicleToDepot::do_post(CommandCallback *callback) { + return _SendVehicleToDepot_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id, this->depot_cmd, this->vli); +} +bool SendVehicleToDepot::do_test() { + return (::Command::Do(DC_NONE, veh_id, depot_cmd, vli)).Succeeded(); } -bool BuildSignalTrack::DoPost() { - return ::Command::Post(this->error, this->tile, this->end_tile, this->track, this->sigtype, this->sigvar, this->mode, this->autofill, this->minimise_gaps, this->signal_density); +template +inline constexpr auto MakeDispatchTableChangeServiceInt(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildSignalTrack::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->end_tile, this->track, this->sigtype, this->sigvar, this->mode, this->autofill, this->minimise_gaps, this->signal_density)).Succeeded(); +static constexpr auto _ChangeServiceInt_dispatch = MakeDispatchTableChangeServiceInt(std::make_index_sequence<_callback_tuple_size>{}); +bool ChangeServiceInt::do_post(CommandCallback *callback) { + return _ChangeServiceInt_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id, this->serv_int, this->is_custom, this->is_percent); +} +bool ChangeServiceInt::do_test() { + return (::Command::Do(DC_NONE, veh_id, serv_int, is_custom, is_percent)).Succeeded(); } -bool RemoveSignalTrack::DoPost() { - return ::Command::Post(this->error, this->tile, this->end_tile, this->track, this->autofill); +template +inline constexpr auto MakeDispatchTableRenameVehicle(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool RemoveSignalTrack::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->end_tile, this->track, this->autofill)).Succeeded(); +static constexpr auto _RenameVehicle_dispatch = MakeDispatchTableRenameVehicle(std::make_index_sequence<_callback_tuple_size>{}); +bool RenameVehicle::do_post(CommandCallback *callback) { + return _RenameVehicle_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id, this->text); +} +bool RenameVehicle::do_test() { + return (::Command::Do(DC_NONE, veh_id, text)).Succeeded(); } -bool BuildLongRoad::DoPost() { - return ::Command::Post(this->error, this->tile, this->start_tile, this->rt, this->axis, this->drd, this->start_half, this->end_half, this->is_ai); +template +inline constexpr auto MakeDispatchTableCloneVehicle(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildLongRoad::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->start_tile, this->rt, this->axis, this->drd, this->start_half, this->end_half, this->is_ai)).Succeeded(); +static constexpr auto _CloneVehicle_dispatch = MakeDispatchTableCloneVehicle(std::make_index_sequence<_callback_tuple_size>{}); +bool CloneVehicle::do_post(CommandCallback *callback) { + return _CloneVehicle_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id, this->share_orders); +} +bool CloneVehicle::do_test() { + return std::get<0>(::Command::Do(DC_NONE, this->tile, veh_id, share_orders)).Succeeded(); } -bool RemoveLongRoad::DoPost() { - return ::Command::Post(this->error, this->tile, this->start_tile, this->rt, this->axis, this->start_half, this->end_half); +template +inline constexpr auto MakeDispatchTableStartStopVehicle(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool RemoveLongRoad::DoTest() { - return std::get<0>(::Command::Do(DC_NONE, this->tile, this->start_tile, this->rt, this->axis, this->start_half, this->end_half)).Succeeded(); +static constexpr auto _StartStopVehicle_dispatch = MakeDispatchTableStartStopVehicle(std::make_index_sequence<_callback_tuple_size>{}); +bool StartStopVehicle::do_post(CommandCallback *callback) { + return _StartStopVehicle_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id, this->evaluate_startstop_cb); +} +bool StartStopVehicle::do_test() { + return (::Command::Do(DC_NONE, veh_id, evaluate_startstop_cb)).Succeeded(); } -bool BuildRoad::DoPost() { - return ::Command::Post(this->error, this->tile, this->pieces, this->rt, this->toggle_drd, this->town_id); +template +inline constexpr auto MakeDispatchTableMassStartStopVehicle(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildRoad::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->pieces, this->rt, this->toggle_drd, this->town_id)).Succeeded(); +static constexpr auto _MassStartStopVehicle_dispatch = MakeDispatchTableMassStartStopVehicle(std::make_index_sequence<_callback_tuple_size>{}); +bool MassStartStopVehicle::do_post(CommandCallback *callback) { + return _MassStartStopVehicle_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->do_start, this->vehicle_list_window, this->vli); +} +bool MassStartStopVehicle::do_test() { + return (::Command::Do(DC_NONE, this->tile, do_start, vehicle_list_window, vli)).Succeeded(); } -bool BuildRoadDepot::DoPost() { - return ::Command::Post(this->error, this->tile, this->rt, this->dir); +template +inline constexpr auto MakeDispatchTableDepotSellAllVehicles(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildRoadDepot::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->rt, this->dir)).Succeeded(); +static constexpr auto _DepotSellAllVehicles_dispatch = MakeDispatchTableDepotSellAllVehicles(std::make_index_sequence<_callback_tuple_size>{}); +bool DepotSellAllVehicles::do_post(CommandCallback *callback) { + return _DepotSellAllVehicles_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->vehicle_type); +} +bool DepotSellAllVehicles::do_test() { + return (::Command::Do(DC_NONE, this->tile, vehicle_type)).Succeeded(); } -bool ConvertRoad::DoPost() { - return ::Command::Post(this->error, this->tile, this->area_start, this->to_type); +template +inline constexpr auto MakeDispatchTableDepotMassAutoReplace(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool ConvertRoad::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->area_start, this->to_type)).Succeeded(); +static constexpr auto _DepotMassAutoReplace_dispatch = MakeDispatchTableDepotMassAutoReplace(std::make_index_sequence<_callback_tuple_size>{}); +bool DepotMassAutoReplace::do_post(CommandCallback *callback) { + return _DepotMassAutoReplace_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->vehicle_type); +} +bool DepotMassAutoReplace::do_test() { + return (::Command::Do(DC_NONE, this->tile, vehicle_type)).Succeeded(); } -bool BuildAirport::DoPost() { - return ::Command::Post(this->error, this->tile, this->airport_type, this->layout, this->station_to_join, this->allow_adjacent); +template +inline constexpr auto MakeDispatchTableChangeSetting(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildAirport::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->airport_type, this->layout, this->station_to_join, this->allow_adjacent)).Succeeded(); +static constexpr auto _ChangeSetting_dispatch = MakeDispatchTableChangeSetting(std::make_index_sequence<_callback_tuple_size>{}); +bool ChangeSetting::do_post(CommandCallback *callback) { + return _ChangeSetting_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->name, this->value); +} +bool ChangeSetting::do_test() { + return (::Command::Do(DC_NONE, name, value)).Succeeded(); } -bool BuildDock::DoPost() { - return ::Command::Post(this->error, this->tile, this->station_to_join, this->adjacent); +template +inline constexpr auto MakeDispatchTableChangeCompanySetting(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildDock::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->station_to_join, this->adjacent)).Succeeded(); +static constexpr auto _ChangeCompanySetting_dispatch = MakeDispatchTableChangeCompanySetting(std::make_index_sequence<_callback_tuple_size>{}); +bool ChangeCompanySetting::do_post(CommandCallback *callback) { + return _ChangeCompanySetting_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->name, this->value); +} +bool ChangeCompanySetting::do_test() { + return (::Command::Do(DC_NONE, name, value)).Succeeded(); } -bool BuildRailStation::DoPost() { - return ::Command::Post(this->error, this->tile, this->rt, this->axis, this->numtracks, this->plat_len, this->spec_class, this->spec_index, this->station_to_join, this->adjacent); +template +inline constexpr auto MakeDispatchTableCreateGroup(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildRailStation::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->rt, this->axis, this->numtracks, this->plat_len, this->spec_class, this->spec_index, this->station_to_join, this->adjacent)).Succeeded(); +static constexpr auto _CreateGroup_dispatch = MakeDispatchTableCreateGroup(std::make_index_sequence<_callback_tuple_size>{}); +bool CreateGroup::do_post(CommandCallback *callback) { + return _CreateGroup_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->vt, this->parent_group); +} +bool CreateGroup::do_test() { + return std::get<0>(::Command::Do(DC_NONE, vt, parent_group)).Succeeded(); } -bool RemoveFromRailStation::DoPost() { - return ::Command::Post(this->error, this->tile, this->end, this->keep_rail); +template +inline constexpr auto MakeDispatchTableAlterGroup(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool RemoveFromRailStation::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->end, this->keep_rail)).Succeeded(); +static constexpr auto _AlterGroup_dispatch = MakeDispatchTableAlterGroup(std::make_index_sequence<_callback_tuple_size>{}); +bool AlterGroup::do_post(CommandCallback *callback) { + return _AlterGroup_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->mode, this->group_id, this->parent_id, this->text); +} +bool AlterGroup::do_test() { + return (::Command::Do(DC_NONE, mode, group_id, parent_id, text)).Succeeded(); } -bool BuildRoadStop::DoPost() { - return ::Command::Post(this->error, this->tile, this->width, this->length, this->stop_type, this->is_drive_through, this->ddir, this->rt, this->station_to_join, this->adjacent); +template +inline constexpr auto MakeDispatchTableDeleteGroup(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildRoadStop::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->width, this->length, this->stop_type, this->is_drive_through, this->ddir, this->rt, this->station_to_join, this->adjacent)).Succeeded(); +static constexpr auto _DeleteGroup_dispatch = MakeDispatchTableDeleteGroup(std::make_index_sequence<_callback_tuple_size>{}); +bool DeleteGroup::do_post(CommandCallback *callback) { + return _DeleteGroup_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->group_id); +} +bool DeleteGroup::do_test() { + return (::Command::Do(DC_NONE, group_id)).Succeeded(); } -bool RemoveRoadStop::DoPost() { - return ::Command::Post(this->error, this->tile, this->width, this->height, this->stop_type, this->remove_road); +template +inline constexpr auto MakeDispatchTableAddVehicleGroup(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool RemoveRoadStop::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->width, this->height, this->stop_type, this->remove_road)).Succeeded(); +static constexpr auto _AddVehicleGroup_dispatch = MakeDispatchTableAddVehicleGroup(std::make_index_sequence<_callback_tuple_size>{}); +bool AddVehicleGroup::do_post(CommandCallback *callback) { + return _AddVehicleGroup_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->group_id, this->veh_id, this->add_shared); +} +bool AddVehicleGroup::do_test() { + return std::get<0>(::Command::Do(DC_NONE, group_id, veh_id, add_shared)).Succeeded(); } -bool RenameStation::DoPost() { - return ::Command::Post(this->error, this->tile, this->station_id, this->text); +template +inline constexpr auto MakeDispatchTableAddSharedVehicleGroup(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool RenameStation::DoTest() { - return (::Command::Do(DC_NONE, this->station_id, this->text)).Succeeded(); +static constexpr auto _AddSharedVehicleGroup_dispatch = MakeDispatchTableAddSharedVehicleGroup(std::make_index_sequence<_callback_tuple_size>{}); +bool AddSharedVehicleGroup::do_post(CommandCallback *callback) { + return _AddSharedVehicleGroup_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->id_g, this->type); +} +bool AddSharedVehicleGroup::do_test() { + return (::Command::Do(DC_NONE, id_g, type)).Succeeded(); } -bool OpenCloseAirport::DoPost() { - return ::Command::Post(this->error, this->tile, this->station_id); +template +inline constexpr auto MakeDispatchTableRemoveAllVehiclesGroup(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool OpenCloseAirport::DoTest() { - return (::Command::Do(DC_NONE, this->station_id)).Succeeded(); +static constexpr auto _RemoveAllVehiclesGroup_dispatch = MakeDispatchTableRemoveAllVehiclesGroup(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveAllVehiclesGroup::do_post(CommandCallback *callback) { + return _RemoveAllVehiclesGroup_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->group_id); +} +bool RemoveAllVehiclesGroup::do_test() { + return (::Command::Do(DC_NONE, group_id)).Succeeded(); } -bool FoundTown::DoPost() { - return ::Command::Post(this->error, this->tile, this->size, this->city, this->layout, this->random_location, this->townnameparts, this->text); +template +inline constexpr auto MakeDispatchTableSetGroupFlag(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool FoundTown::DoTest() { - return std::get<0>(::Command::Do(DC_NONE, this->tile, this->size, this->city, this->layout, this->random_location, this->townnameparts, this->text)).Succeeded(); +static constexpr auto _SetGroupFlag_dispatch = MakeDispatchTableSetGroupFlag(std::make_index_sequence<_callback_tuple_size>{}); +bool SetGroupFlag::do_post(CommandCallback *callback) { + return _SetGroupFlag_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->group_id, this->flag, this->value, this->recursive); +} +bool SetGroupFlag::do_test() { + return (::Command::Do(DC_NONE, group_id, flag, value, recursive)).Succeeded(); } -bool RenameTown::DoPost() { - return ::Command::Post(this->error, this->tile, this->town_id, this->text); +template +inline constexpr auto MakeDispatchTableSetGroupLivery(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool RenameTown::DoTest() { - return (::Command::Do(DC_NONE, this->town_id, this->text)).Succeeded(); +static constexpr auto _SetGroupLivery_dispatch = MakeDispatchTableSetGroupLivery(std::make_index_sequence<_callback_tuple_size>{}); +bool SetGroupLivery::do_post(CommandCallback *callback) { + return _SetGroupLivery_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->group_id, this->primary, this->colour); +} +bool SetGroupLivery::do_test() { + return (::Command::Do(DC_NONE, group_id, primary, colour)).Succeeded(); } -bool DoTownAction::DoPost() { - return ::Command::Post(this->error, this->tile, this->town_id, this->action); +template +inline constexpr auto MakeDispatchTableTurnRoadVeh(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool DoTownAction::DoTest() { - return (::Command::Do(DC_NONE, this->town_id, this->action)).Succeeded(); +static constexpr auto _TurnRoadVeh_dispatch = MakeDispatchTableTurnRoadVeh(std::make_index_sequence<_callback_tuple_size>{}); +bool TurnRoadVeh::do_post(CommandCallback *callback) { + return _TurnRoadVeh_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id); +} +bool TurnRoadVeh::do_test() { + return (::Command::Do(DC_NONE, veh_id)).Succeeded(); } -bool TownGrowthRate::DoPost() { - return ::Command::Post(this->error, this->tile, this->town_id, this->growth_rate); +template +inline constexpr auto MakeDispatchTableChangeTimetable(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool TownGrowthRate::DoTest() { - return (::Command::Do(DC_NONE, this->town_id, this->growth_rate)).Succeeded(); +static constexpr auto _ChangeTimetable_dispatch = MakeDispatchTableChangeTimetable(std::make_index_sequence<_callback_tuple_size>{}); +bool ChangeTimetable::do_post(CommandCallback *callback) { + return _ChangeTimetable_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh, this->order_number, this->mtf, this->data); +} +bool ChangeTimetable::do_test() { + return (::Command::Do(DC_NONE, veh, order_number, mtf, data)).Succeeded(); } -bool TownRating::DoPost() { - return ::Command::Post(this->error, this->tile, this->town_id, this->company_id, this->rating); +template +inline constexpr auto MakeDispatchTableSetVehicleOnTime(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool TownRating::DoTest() { - return (::Command::Do(DC_NONE, this->town_id, this->company_id, this->rating)).Succeeded(); +static constexpr auto _SetVehicleOnTime_dispatch = MakeDispatchTableSetVehicleOnTime(std::make_index_sequence<_callback_tuple_size>{}); +bool SetVehicleOnTime::do_post(CommandCallback *callback) { + return _SetVehicleOnTime_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh); +} +bool SetVehicleOnTime::do_test() { + return (::Command::Do(DC_NONE, veh)).Succeeded(); } -bool TownCargoGoal::DoPost() { - return ::Command::Post(this->error, this->tile, this->town_id, this->te, this->goal); +template +inline constexpr auto MakeDispatchTableAutofillTimetable(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool TownCargoGoal::DoTest() { - return (::Command::Do(DC_NONE, this->town_id, this->te, this->goal)).Succeeded(); +static constexpr auto _AutofillTimetable_dispatch = MakeDispatchTableAutofillTimetable(std::make_index_sequence<_callback_tuple_size>{}); +bool AutofillTimetable::do_post(CommandCallback *callback) { + return _AutofillTimetable_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh, this->autofill, this->preserve_wait_time); +} +bool AutofillTimetable::do_test() { + return (::Command::Do(DC_NONE, veh, autofill, preserve_wait_time)).Succeeded(); } -bool TownSetText::DoPost() { - return ::Command::Post(this->error, this->tile, this->town_id, this->text); +template +inline constexpr auto MakeDispatchTableSetTimetableStart(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool TownSetText::DoTest() { - return (::Command::Do(DC_NONE, this->town_id, this->text)).Succeeded(); +static constexpr auto _SetTimetableStart_dispatch = MakeDispatchTableSetTimetableStart(std::make_index_sequence<_callback_tuple_size>{}); +bool SetTimetableStart::do_post(CommandCallback *callback) { + return _SetTimetableStart_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id, this->timetable_all, this->start_date); +} +bool SetTimetableStart::do_test() { + return (::Command::Do(DC_NONE, veh_id, timetable_all, start_date)).Succeeded(); } -bool ExpandTown::DoPost() { - return ::Command::Post(this->error, this->tile, this->town_id, this->grow_amount); +template +inline constexpr auto MakeDispatchTableWantEnginePreview(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool ExpandTown::DoTest() { - return (::Command::Do(DC_NONE, this->town_id, this->grow_amount)).Succeeded(); +static constexpr auto _WantEnginePreview_dispatch = MakeDispatchTableWantEnginePreview(std::make_index_sequence<_callback_tuple_size>{}); +bool WantEnginePreview::do_post(CommandCallback *callback) { + return _WantEnginePreview_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->engine_id); +} +bool WantEnginePreview::do_test() { + return (::Command::Do(DC_NONE, engine_id)).Succeeded(); } -bool DeleteTown::DoPost() { - return ::Command::Post(this->error, this->tile, this->town_id); +template +inline constexpr auto MakeDispatchTableEngineCtrl(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool DeleteTown::DoTest() { - return (::Command::Do(DC_NONE, this->town_id)).Succeeded(); +static constexpr auto _EngineCtrl_dispatch = MakeDispatchTableEngineCtrl(std::make_index_sequence<_callback_tuple_size>{}); +bool EngineCtrl::do_post(CommandCallback *callback) { + return _EngineCtrl_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->engine_id, this->company_id, this->allow); +} +bool EngineCtrl::do_test() { + return (::Command::Do(DC_NONE, engine_id, company_id, allow)).Succeeded(); } -bool BuildBridge::DoPost() { - return ::Command::Post(this->error, this->tile, this->tile_start, this->transport_type, this->bridge_type, this->road_rail_type); +template +inline constexpr auto MakeDispatchTableRenameEngine(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildBridge::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->tile_start, this->transport_type, this->bridge_type, this->road_rail_type)).Succeeded(); +static constexpr auto _RenameEngine_dispatch = MakeDispatchTableRenameEngine(std::make_index_sequence<_callback_tuple_size>{}); +bool RenameEngine::do_post(CommandCallback *callback) { + return _RenameEngine_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->engine_id, this->text); +} +bool RenameEngine::do_test() { + return (::Command::Do(DC_NONE, engine_id, text)).Succeeded(); } -bool BuildTunnel::DoPost() { - return ::Command::Post(this->error, this->tile, this->transport_type, this->road_rail_type); +template +inline constexpr auto MakeDispatchTableSetVehicleVisibility(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; } -bool BuildTunnel::DoTest() { - return (::Command::Do(DC_NONE, this->tile, this->transport_type, this->road_rail_type)).Succeeded(); +static constexpr auto _SetVehicleVisibility_dispatch = MakeDispatchTableSetVehicleVisibility(std::make_index_sequence<_callback_tuple_size>{}); +bool SetVehicleVisibility::do_post(CommandCallback *callback) { + return _SetVehicleVisibility_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->engine_id, this->hide); +} +bool SetVehicleVisibility::do_test() { + return (::Command::Do(DC_NONE, engine_id, hide)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTablePlantTree(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _PlantTree_dispatch = MakeDispatchTablePlantTree(std::make_index_sequence<_callback_tuple_size>{}); +bool PlantTree::do_post(CommandCallback *callback) { + return _PlantTree_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->start_tile, this->tree_to_plant); +} +bool PlantTree::do_test() { + return (::Command::Do(DC_NONE, this->tile, start_tile, tree_to_plant)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableLandscapeClear(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _LandscapeClear_dispatch = MakeDispatchTableLandscapeClear(std::make_index_sequence<_callback_tuple_size>{}); +bool LandscapeClear::do_post(CommandCallback *callback) { + return _LandscapeClear_dispatch[FindCallbackIndex(callback)](this->error, this->tile); +} +bool LandscapeClear::do_test() { + return (::Command::Do(DC_NONE, this->tile)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableClearArea(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _ClearArea_dispatch = MakeDispatchTableClearArea(std::make_index_sequence<_callback_tuple_size>{}); +bool ClearArea::do_post(CommandCallback *callback) { + return _ClearArea_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->start_tile, this->diagonal); +} +bool ClearArea::do_test() { + return std::get<0>(::Command::Do(DC_NONE, this->tile, start_tile, diagonal)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildAirport(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildAirport_dispatch = MakeDispatchTableBuildAirport(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildAirport::do_post(CommandCallback *callback) { + return _BuildAirport_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->airport_type, this->layout, this->station_to_join, this->adjacent); +} +bool BuildAirport::do_test() { + return (::Command::Do(DC_NONE, this->tile, airport_type, layout, station_to_join, adjacent)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildDock(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildDock_dispatch = MakeDispatchTableBuildDock(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildDock::do_post(CommandCallback *callback) { + return _BuildDock_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->station_to_join, this->adjacent); +} +bool BuildDock::do_test() { + return (::Command::Do(DC_NONE, this->tile, station_to_join, adjacent)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildRailStation(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildRailStation_dispatch = MakeDispatchTableBuildRailStation(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildRailStation::do_post(CommandCallback *callback) { + return _BuildRailStation_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->rt, this->axis, this->numtracks, this->plat_len, this->spec_class, this->spec_index, this->station_to_join, this->adjacent); +} +bool BuildRailStation::do_test() { + return (::Command::Do(DC_NONE, this->tile, rt, axis, numtracks, plat_len, spec_class, spec_index, station_to_join, adjacent)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRemoveFromRailStation(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RemoveFromRailStation_dispatch = MakeDispatchTableRemoveFromRailStation(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveFromRailStation::do_post(CommandCallback *callback) { + return _RemoveFromRailStation_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->end, this->keep_rail); +} +bool RemoveFromRailStation::do_test() { + return (::Command::Do(DC_NONE, this->tile, end, keep_rail)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildRoadStop(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildRoadStop_dispatch = MakeDispatchTableBuildRoadStop(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildRoadStop::do_post(CommandCallback *callback) { + return _BuildRoadStop_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->width, this->length, this->stop_type, this->is_drive_through, this->ddir, this->rt, this->station_to_join, this->adjacent); +} +bool BuildRoadStop::do_test() { + return (::Command::Do(DC_NONE, this->tile, width, length, stop_type, is_drive_through, ddir, rt, station_to_join, adjacent)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRemoveRoadStop(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RemoveRoadStop_dispatch = MakeDispatchTableRemoveRoadStop(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveRoadStop::do_post(CommandCallback *callback) { + return _RemoveRoadStop_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->width, this->height, this->stop_type, this->remove_road); +} +bool RemoveRoadStop::do_test() { + return (::Command::Do(DC_NONE, this->tile, width, height, stop_type, remove_road)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRenameStation(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RenameStation_dispatch = MakeDispatchTableRenameStation(std::make_index_sequence<_callback_tuple_size>{}); +bool RenameStation::do_post(CommandCallback *callback) { + return _RenameStation_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->station_id, this->text); +} +bool RenameStation::do_test() { + return (::Command::Do(DC_NONE, station_id, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableOpenCloseAirport(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _OpenCloseAirport_dispatch = MakeDispatchTableOpenCloseAirport(std::make_index_sequence<_callback_tuple_size>{}); +bool OpenCloseAirport::do_post(CommandCallback *callback) { + return _OpenCloseAirport_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->station_id); +} +bool OpenCloseAirport::do_test() { + return (::Command::Do(DC_NONE, station_id)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableCompanyCtrl(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _CompanyCtrl_dispatch = MakeDispatchTableCompanyCtrl(std::make_index_sequence<_callback_tuple_size>{}); +bool CompanyCtrl::do_post(CommandCallback *callback) { + return _CompanyCtrl_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->cca, this->company_id, this->reason, this->client_id); +} +bool CompanyCtrl::do_test() { + return (::Command::Do(DC_NONE, cca, company_id, reason, client_id)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableGiveMoney(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _GiveMoney_dispatch = MakeDispatchTableGiveMoney(std::make_index_sequence<_callback_tuple_size>{}); +bool GiveMoney::do_post(CommandCallback *callback) { + return _GiveMoney_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->money, this->dest_company); +} +bool GiveMoney::do_test() { + return (::Command::Do(DC_NONE, money, dest_company)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRenameCompany(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RenameCompany_dispatch = MakeDispatchTableRenameCompany(std::make_index_sequence<_callback_tuple_size>{}); +bool RenameCompany::do_post(CommandCallback *callback) { + return _RenameCompany_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->text); +} +bool RenameCompany::do_test() { + return (::Command::Do(DC_NONE, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRenamePresident(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RenamePresident_dispatch = MakeDispatchTableRenamePresident(std::make_index_sequence<_callback_tuple_size>{}); +bool RenamePresident::do_post(CommandCallback *callback) { + return _RenamePresident_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->text); +} +bool RenamePresident::do_test() { + return (::Command::Do(DC_NONE, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableSetCompanyManagerFace(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _SetCompanyManagerFace_dispatch = MakeDispatchTableSetCompanyManagerFace(std::make_index_sequence<_callback_tuple_size>{}); +bool SetCompanyManagerFace::do_post(CommandCallback *callback) { + return _SetCompanyManagerFace_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->cmf); +} +bool SetCompanyManagerFace::do_test() { + return (::Command::Do(DC_NONE, cmf)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableSetCompanyColour(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _SetCompanyColour_dispatch = MakeDispatchTableSetCompanyColour(std::make_index_sequence<_callback_tuple_size>{}); +bool SetCompanyColour::do_post(CommandCallback *callback) { + return _SetCompanyColour_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->scheme, this->primary, this->colour); +} +bool SetCompanyColour::do_test() { + return (::Command::Do(DC_NONE, scheme, primary, colour)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRenameDepot(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RenameDepot_dispatch = MakeDispatchTableRenameDepot(std::make_index_sequence<_callback_tuple_size>{}); +bool RenameDepot::do_post(CommandCallback *callback) { + return _RenameDepot_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->depot_id, this->text); +} +bool RenameDepot::do_test() { + return (::Command::Do(DC_NONE, depot_id, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableAutoreplaceVehicle(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _AutoreplaceVehicle_dispatch = MakeDispatchTableAutoreplaceVehicle(std::make_index_sequence<_callback_tuple_size>{}); +bool AutoreplaceVehicle::do_post(CommandCallback *callback) { + return _AutoreplaceVehicle_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id); +} +bool AutoreplaceVehicle::do_test() { + return (::Command::Do(DC_NONE, veh_id)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableSetAutoReplace(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _SetAutoReplace_dispatch = MakeDispatchTableSetAutoReplace(std::make_index_sequence<_callback_tuple_size>{}); +bool SetAutoReplace::do_post(CommandCallback *callback) { + return _SetAutoReplace_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->id_g, this->old_engine_type, this->new_engine_type, this->when_old); +} +bool SetAutoReplace::do_test() { + return (::Command::Do(DC_NONE, id_g, old_engine_type, new_engine_type, when_old)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildShipDepot(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildShipDepot_dispatch = MakeDispatchTableBuildShipDepot(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildShipDepot::do_post(CommandCallback *callback) { + return _BuildShipDepot_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->axis); +} +bool BuildShipDepot::do_test() { + return (::Command::Do(DC_NONE, this->tile, axis)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildCanal(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildCanal_dispatch = MakeDispatchTableBuildCanal(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildCanal::do_post(CommandCallback *callback) { + return _BuildCanal_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->start_tile, this->wc, this->diagonal); +} +bool BuildCanal::do_test() { + return (::Command::Do(DC_NONE, this->tile, start_tile, wc, diagonal)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildLock(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildLock_dispatch = MakeDispatchTableBuildLock(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildLock::do_post(CommandCallback *callback) { + return _BuildLock_dispatch[FindCallbackIndex(callback)](this->error, this->tile); +} +bool BuildLock::do_test() { + return (::Command::Do(DC_NONE, this->tile)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildLongRoad(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildLongRoad_dispatch = MakeDispatchTableBuildLongRoad(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildLongRoad::do_post(CommandCallback *callback) { + return _BuildLongRoad_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->start_tile, this->rt, this->axis, this->drd, this->start_half, this->end_half, this->is_ai); +} +bool BuildLongRoad::do_test() { + return (::Command::Do(DC_NONE, this->tile, start_tile, rt, axis, drd, start_half, end_half, is_ai)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRemoveLongRoad(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RemoveLongRoad_dispatch = MakeDispatchTableRemoveLongRoad(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveLongRoad::do_post(CommandCallback *callback) { + return _RemoveLongRoad_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->start_tile, this->rt, this->axis, this->start_half, this->end_half); +} +bool RemoveLongRoad::do_test() { + return std::get<0>(::Command::Do(DC_NONE, this->tile, start_tile, rt, axis, start_half, end_half)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildRoad(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildRoad_dispatch = MakeDispatchTableBuildRoad(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildRoad::do_post(CommandCallback *callback) { + return _BuildRoad_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->pieces, this->rt, this->toggle_drd, this->town_id); +} +bool BuildRoad::do_test() { + return (::Command::Do(DC_NONE, this->tile, pieces, rt, toggle_drd, town_id)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildRoadDepot(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildRoadDepot_dispatch = MakeDispatchTableBuildRoadDepot(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildRoadDepot::do_post(CommandCallback *callback) { + return _BuildRoadDepot_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->rt, this->dir); +} +bool BuildRoadDepot::do_test() { + return (::Command::Do(DC_NONE, this->tile, rt, dir)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableConvertRoad(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _ConvertRoad_dispatch = MakeDispatchTableConvertRoad(std::make_index_sequence<_callback_tuple_size>{}); +bool ConvertRoad::do_post(CommandCallback *callback) { + return _ConvertRoad_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->area_start, this->to_type); +} +bool ConvertRoad::do_test() { + return (::Command::Do(DC_NONE, this->tile, area_start, to_type)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildRailroadTrack(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildRailroadTrack_dispatch = MakeDispatchTableBuildRailroadTrack(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildRailroadTrack::do_post(CommandCallback *callback) { + return _BuildRailroadTrack_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->start_tile, this->railtype, this->track, this->auto_remove_signals, this->fail_on_obstacle); +} +bool BuildRailroadTrack::do_test() { + return (::Command::Do(DC_NONE, this->tile, start_tile, railtype, track, auto_remove_signals, fail_on_obstacle)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRemoveRailroadTrack(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RemoveRailroadTrack_dispatch = MakeDispatchTableRemoveRailroadTrack(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveRailroadTrack::do_post(CommandCallback *callback) { + return _RemoveRailroadTrack_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->start_tile, this->track); +} +bool RemoveRailroadTrack::do_test() { + return (::Command::Do(DC_NONE, this->tile, start_tile, track)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildSingleRail(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildSingleRail_dispatch = MakeDispatchTableBuildSingleRail(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildSingleRail::do_post(CommandCallback *callback) { + return _BuildSingleRail_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->railtype, this->track, this->auto_remove_signals); +} +bool BuildSingleRail::do_test() { + return (::Command::Do(DC_NONE, this->tile, railtype, track, auto_remove_signals)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRemoveSingleRail(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RemoveSingleRail_dispatch = MakeDispatchTableRemoveSingleRail(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveSingleRail::do_post(CommandCallback *callback) { + return _RemoveSingleRail_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->track); +} +bool RemoveSingleRail::do_test() { + return (::Command::Do(DC_NONE, this->tile, track)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildTrainDepot(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildTrainDepot_dispatch = MakeDispatchTableBuildTrainDepot(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildTrainDepot::do_post(CommandCallback *callback) { + return _BuildTrainDepot_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->railtype, this->dir); +} +bool BuildTrainDepot::do_test() { + return (::Command::Do(DC_NONE, this->tile, railtype, dir)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildSingleSignal(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildSingleSignal_dispatch = MakeDispatchTableBuildSingleSignal(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildSingleSignal::do_post(CommandCallback *callback) { + return _BuildSingleSignal_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->track, this->sigtype, this->sigvar, this->convert_signal, this->skip_existing_signals, this->ctrl_pressed, this->cycle_start, this->cycle_stop, this->num_dir_cycle, this->signals_copy); +} +bool BuildSingleSignal::do_test() { + return (::Command::Do(DC_NONE, this->tile, track, sigtype, sigvar, convert_signal, skip_existing_signals, ctrl_pressed, cycle_start, cycle_stop, num_dir_cycle, signals_copy)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRemoveSingleSignal(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RemoveSingleSignal_dispatch = MakeDispatchTableRemoveSingleSignal(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveSingleSignal::do_post(CommandCallback *callback) { + return _RemoveSingleSignal_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->track); +} +bool RemoveSingleSignal::do_test() { + return (::Command::Do(DC_NONE, this->tile, track)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableConvertRail(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _ConvertRail_dispatch = MakeDispatchTableConvertRail(std::make_index_sequence<_callback_tuple_size>{}); +bool ConvertRail::do_post(CommandCallback *callback) { + return _ConvertRail_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->area_start, this->totype, this->diagonal); +} +bool ConvertRail::do_test() { + return (::Command::Do(DC_NONE, this->tile, area_start, totype, diagonal)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildSignalTrack(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildSignalTrack_dispatch = MakeDispatchTableBuildSignalTrack(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildSignalTrack::do_post(CommandCallback *callback) { + return _BuildSignalTrack_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->end_tile, this->track, this->sigtype, this->sigvar, this->mode, this->autofill, this->minimise_gaps, this->signal_density); +} +bool BuildSignalTrack::do_test() { + return (::Command::Do(DC_NONE, this->tile, end_tile, track, sigtype, sigvar, mode, autofill, minimise_gaps, signal_density)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRemoveSignalTrack(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RemoveSignalTrack_dispatch = MakeDispatchTableRemoveSignalTrack(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveSignalTrack::do_post(CommandCallback *callback) { + return _RemoveSignalTrack_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->end_tile, this->track, this->autofill); +} +bool RemoveSignalTrack::do_test() { + return (::Command::Do(DC_NONE, this->tile, end_tile, track, autofill)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildIndustry(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildIndustry_dispatch = MakeDispatchTableBuildIndustry(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildIndustry::do_post(CommandCallback *callback) { + return _BuildIndustry_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->it, this->first_layout, this->fund, this->seed); +} +bool BuildIndustry::do_test() { + return (::Command::Do(DC_NONE, this->tile, it, first_layout, fund, seed)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableIndustryCtrl(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _IndustryCtrl_dispatch = MakeDispatchTableIndustryCtrl(std::make_index_sequence<_callback_tuple_size>{}); +bool IndustryCtrl::do_post(CommandCallback *callback) { + return _IndustryCtrl_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->ind_id, this->action, this->ctlflags, this->company_id, this->text); +} +bool IndustryCtrl::do_test() { + return (::Command::Do(DC_NONE, ind_id, action, ctlflags, company_id, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildRailWaypoint(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildRailWaypoint_dispatch = MakeDispatchTableBuildRailWaypoint(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildRailWaypoint::do_post(CommandCallback *callback) { + return _BuildRailWaypoint_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->axis, this->width, this->height, this->spec_class, this->spec_index, this->station_to_join, this->adjacent); +} +bool BuildRailWaypoint::do_test() { + return (::Command::Do(DC_NONE, this->tile, axis, width, height, spec_class, spec_index, station_to_join, adjacent)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRemoveFromRailWaypoint(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RemoveFromRailWaypoint_dispatch = MakeDispatchTableRemoveFromRailWaypoint(std::make_index_sequence<_callback_tuple_size>{}); +bool RemoveFromRailWaypoint::do_post(CommandCallback *callback) { + return _RemoveFromRailWaypoint_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->end, this->keep_rail); +} +bool RemoveFromRailWaypoint::do_test() { + return (::Command::Do(DC_NONE, this->tile, end, keep_rail)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildBuoy(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildBuoy_dispatch = MakeDispatchTableBuildBuoy(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildBuoy::do_post(CommandCallback *callback) { + return _BuildBuoy_dispatch[FindCallbackIndex(callback)](this->error, this->tile); +} +bool BuildBuoy::do_test() { + return (::Command::Do(DC_NONE, this->tile)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRenameWaypoint(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RenameWaypoint_dispatch = MakeDispatchTableRenameWaypoint(std::make_index_sequence<_callback_tuple_size>{}); +bool RenameWaypoint::do_post(CommandCallback *callback) { + return _RenameWaypoint_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->waypoint_id, this->text); +} +bool RenameWaypoint::do_test() { + return (::Command::Do(DC_NONE, waypoint_id, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableFoundTown(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _FoundTown_dispatch = MakeDispatchTableFoundTown(std::make_index_sequence<_callback_tuple_size>{}); +bool FoundTown::do_post(CommandCallback *callback) { + return _FoundTown_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->size, this->city, this->layout, this->random_location, this->townnameparts, this->text); +} +bool FoundTown::do_test() { + return std::get<0>(::Command::Do(DC_NONE, this->tile, size, city, layout, random_location, townnameparts, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRenameTown(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RenameTown_dispatch = MakeDispatchTableRenameTown(std::make_index_sequence<_callback_tuple_size>{}); +bool RenameTown::do_post(CommandCallback *callback) { + return _RenameTown_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->town_id, this->text); +} +bool RenameTown::do_test() { + return (::Command::Do(DC_NONE, town_id, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableDoTownAction(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _DoTownAction_dispatch = MakeDispatchTableDoTownAction(std::make_index_sequence<_callback_tuple_size>{}); +bool DoTownAction::do_post(CommandCallback *callback) { + return _DoTownAction_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->town_id, this->action); +} +bool DoTownAction::do_test() { + return (::Command::Do(DC_NONE, town_id, action)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableTownGrowthRate(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _TownGrowthRate_dispatch = MakeDispatchTableTownGrowthRate(std::make_index_sequence<_callback_tuple_size>{}); +bool TownGrowthRate::do_post(CommandCallback *callback) { + return _TownGrowthRate_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->town_id, this->growth_rate); +} +bool TownGrowthRate::do_test() { + return (::Command::Do(DC_NONE, town_id, growth_rate)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableTownRating(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _TownRating_dispatch = MakeDispatchTableTownRating(std::make_index_sequence<_callback_tuple_size>{}); +bool TownRating::do_post(CommandCallback *callback) { + return _TownRating_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->town_id, this->company_id, this->rating); +} +bool TownRating::do_test() { + return (::Command::Do(DC_NONE, town_id, company_id, rating)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableTownCargoGoal(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _TownCargoGoal_dispatch = MakeDispatchTableTownCargoGoal(std::make_index_sequence<_callback_tuple_size>{}); +bool TownCargoGoal::do_post(CommandCallback *callback) { + return _TownCargoGoal_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->town_id, this->te, this->goal); +} +bool TownCargoGoal::do_test() { + return (::Command::Do(DC_NONE, town_id, te, goal)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableTownSetText(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _TownSetText_dispatch = MakeDispatchTableTownSetText(std::make_index_sequence<_callback_tuple_size>{}); +bool TownSetText::do_post(CommandCallback *callback) { + return _TownSetText_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->town_id, this->text); +} +bool TownSetText::do_test() { + return (::Command::Do(DC_NONE, town_id, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableExpandTown(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _ExpandTown_dispatch = MakeDispatchTableExpandTown(std::make_index_sequence<_callback_tuple_size>{}); +bool ExpandTown::do_post(CommandCallback *callback) { + return _ExpandTown_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->town_id, this->grow_amount); +} +bool ExpandTown::do_test() { + return (::Command::Do(DC_NONE, town_id, grow_amount)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableDeleteTown(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _DeleteTown_dispatch = MakeDispatchTableDeleteTown(std::make_index_sequence<_callback_tuple_size>{}); +bool DeleteTown::do_post(CommandCallback *callback) { + return _DeleteTown_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->town_id); +} +bool DeleteTown::do_test() { + return (::Command::Do(DC_NONE, town_id)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildObject(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildObject_dispatch = MakeDispatchTableBuildObject(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildObject::do_post(CommandCallback *callback) { + return _BuildObject_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->type, this->view); +} +bool BuildObject::do_test() { + return (::Command::Do(DC_NONE, this->tile, type, view)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildObjectArea(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildObjectArea_dispatch = MakeDispatchTableBuildObjectArea(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildObjectArea::do_post(CommandCallback *callback) { + return _BuildObjectArea_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->start_tile, this->type, this->view, this->diagonal); +} +bool BuildObjectArea::do_test() { + return (::Command::Do(DC_NONE, this->tile, start_tile, type, view, diagonal)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableMoveRailVehicle(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _MoveRailVehicle_dispatch = MakeDispatchTableMoveRailVehicle(std::make_index_sequence<_callback_tuple_size>{}); +bool MoveRailVehicle::do_post(CommandCallback *callback) { + return _MoveRailVehicle_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->src_veh, this->dest_veh, this->move_chain); +} +bool MoveRailVehicle::do_test() { + return (::Command::Do(DC_NONE, src_veh, dest_veh, move_chain)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableForceTrainProceed(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _ForceTrainProceed_dispatch = MakeDispatchTableForceTrainProceed(std::make_index_sequence<_callback_tuple_size>{}); +bool ForceTrainProceed::do_post(CommandCallback *callback) { + return _ForceTrainProceed_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id); +} +bool ForceTrainProceed::do_test() { + return (::Command::Do(DC_NONE, veh_id)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableReverseTrainDirection(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _ReverseTrainDirection_dispatch = MakeDispatchTableReverseTrainDirection(std::make_index_sequence<_callback_tuple_size>{}); +bool ReverseTrainDirection::do_post(CommandCallback *callback) { + return _ReverseTrainDirection_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id, this->reverse_single_veh); +} +bool ReverseTrainDirection::do_test() { + return (::Command::Do(DC_NONE, veh_id, reverse_single_veh)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTablePlaceSign(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _PlaceSign_dispatch = MakeDispatchTablePlaceSign(std::make_index_sequence<_callback_tuple_size>{}); +bool PlaceSign::do_post(CommandCallback *callback) { + return _PlaceSign_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->text); +} +bool PlaceSign::do_test() { + return std::get<0>(::Command::Do(DC_NONE, this->tile, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableRenameSign(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _RenameSign_dispatch = MakeDispatchTableRenameSign(std::make_index_sequence<_callback_tuple_size>{}); +bool RenameSign::do_post(CommandCallback *callback) { + return _RenameSign_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->sign_id, this->text); +} +bool RenameSign::do_test() { + return (::Command::Do(DC_NONE, sign_id, text)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildBridge(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildBridge_dispatch = MakeDispatchTableBuildBridge(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildBridge::do_post(CommandCallback *callback) { + return _BuildBridge_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->tile_start, this->transport_type, this->bridge_type, this->road_rail_type); +} +bool BuildBridge::do_test() { + return (::Command::Do(DC_NONE, this->tile, tile_start, transport_type, bridge_type, road_rail_type)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuildTunnel(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuildTunnel_dispatch = MakeDispatchTableBuildTunnel(std::make_index_sequence<_callback_tuple_size>{}); +bool BuildTunnel::do_post(CommandCallback *callback) { + return _BuildTunnel_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->transport_type, this->road_rail_type); +} +bool BuildTunnel::do_test() { + return (::Command::Do(DC_NONE, this->tile, transport_type, road_rail_type)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableTerraformLand(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _TerraformLand_dispatch = MakeDispatchTableTerraformLand(std::make_index_sequence<_callback_tuple_size>{}); +bool TerraformLand::do_post(CommandCallback *callback) { + return _TerraformLand_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->slope, this->dir_up); +} +bool TerraformLand::do_test() { + return std::get<0>(::Command::Do(DC_NONE, this->tile, slope, dir_up)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableLevelLand(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _LevelLand_dispatch = MakeDispatchTableLevelLand(std::make_index_sequence<_callback_tuple_size>{}); +bool LevelLand::do_post(CommandCallback *callback) { + return _LevelLand_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->start_tile, this->diagonal, this->lm); +} +bool LevelLand::do_test() { + return std::get<0>(::Command::Do(DC_NONE, this->tile, start_tile, diagonal, lm)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableMoneyCheat(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _MoneyCheat_dispatch = MakeDispatchTableMoneyCheat(std::make_index_sequence<_callback_tuple_size>{}); +bool MoneyCheat::do_post(CommandCallback *callback) { + return _MoneyCheat_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->amount); +} +bool MoneyCheat::do_test() { + return (::Command::Do(DC_NONE, amount)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableChangeBankBalance(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _ChangeBankBalance_dispatch = MakeDispatchTableChangeBankBalance(std::make_index_sequence<_callback_tuple_size>{}); +bool ChangeBankBalance::do_post(CommandCallback *callback) { + return _ChangeBankBalance_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->delta, this->company, this->expenses_type); +} +bool ChangeBankBalance::do_test() { + return (::Command::Do(DC_NONE, this->tile, delta, company, expenses_type)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableIncreaseLoan(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _IncreaseLoan_dispatch = MakeDispatchTableIncreaseLoan(std::make_index_sequence<_callback_tuple_size>{}); +bool IncreaseLoan::do_post(CommandCallback *callback) { + return _IncreaseLoan_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->cmd, this->amount); +} +bool IncreaseLoan::do_test() { + return (::Command::Do(DC_NONE, cmd, amount)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableDecreaseLoan(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _DecreaseLoan_dispatch = MakeDispatchTableDecreaseLoan(std::make_index_sequence<_callback_tuple_size>{}); +bool DecreaseLoan::do_post(CommandCallback *callback) { + return _DecreaseLoan_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->cmd, this->amount); +} +bool DecreaseLoan::do_test() { + return (::Command::Do(DC_NONE, cmd, amount)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTablePause(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _Pause_dispatch = MakeDispatchTablePause(std::make_index_sequence<_callback_tuple_size>{}); +bool Pause::do_post(CommandCallback *callback) { + return _Pause_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->mode, this->pause); +} +bool Pause::do_test() { + return (::Command::Do(DC_NONE, mode, pause)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableModifyOrder(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _ModifyOrder_dispatch = MakeDispatchTableModifyOrder(std::make_index_sequence<_callback_tuple_size>{}); +bool ModifyOrder::do_post(CommandCallback *callback) { + return _ModifyOrder_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh, this->sel_ord, this->mof, this->data); +} +bool ModifyOrder::do_test() { + return (::Command::Do(DC_NONE, veh, sel_ord, mof, data)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableSkipToOrder(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _SkipToOrder_dispatch = MakeDispatchTableSkipToOrder(std::make_index_sequence<_callback_tuple_size>{}); +bool SkipToOrder::do_post(CommandCallback *callback) { + return _SkipToOrder_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id, this->sel_ord); +} +bool SkipToOrder::do_test() { + return (::Command::Do(DC_NONE, veh_id, sel_ord)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableDeleteOrder(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _DeleteOrder_dispatch = MakeDispatchTableDeleteOrder(std::make_index_sequence<_callback_tuple_size>{}); +bool DeleteOrder::do_post(CommandCallback *callback) { + return _DeleteOrder_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh_id, this->sel_ord); +} +bool DeleteOrder::do_test() { + return (::Command::Do(DC_NONE, veh_id, sel_ord)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableInsertOrder(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _InsertOrder_dispatch = MakeDispatchTableInsertOrder(std::make_index_sequence<_callback_tuple_size>{}); +bool InsertOrder::do_post(CommandCallback *callback) { + return _InsertOrder_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh, this->sel_ord, this->new_order); +} +bool InsertOrder::do_test() { + return (::Command::Do(DC_NONE, veh, sel_ord, new_order)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableOrderRefit(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _OrderRefit_dispatch = MakeDispatchTableOrderRefit(std::make_index_sequence<_callback_tuple_size>{}); +bool OrderRefit::do_post(CommandCallback *callback) { + return _OrderRefit_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh, this->order_number, this->cargo); +} +bool OrderRefit::do_test() { + return (::Command::Do(DC_NONE, veh, order_number, cargo)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableCloneOrder(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _CloneOrder_dispatch = MakeDispatchTableCloneOrder(std::make_index_sequence<_callback_tuple_size>{}); +bool CloneOrder::do_post(CommandCallback *callback) { + return _CloneOrder_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->action, this->veh_dst, this->veh_src); +} +bool CloneOrder::do_test() { + return (::Command::Do(DC_NONE, action, veh_dst, veh_src)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableMoveOrder(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _MoveOrder_dispatch = MakeDispatchTableMoveOrder(std::make_index_sequence<_callback_tuple_size>{}); +bool MoveOrder::do_post(CommandCallback *callback) { + return _MoveOrder_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->veh, this->moving_order, this->target_order); +} +bool MoveOrder::do_test() { + return (::Command::Do(DC_NONE, veh, moving_order, target_order)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableClearOrderBackup(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _ClearOrderBackup_dispatch = MakeDispatchTableClearOrderBackup(std::make_index_sequence<_callback_tuple_size>{}); +bool ClearOrderBackup::do_post(CommandCallback *callback) { + return _ClearOrderBackup_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->user_id); +} +bool ClearOrderBackup::do_test() { + return (::Command::Do(DC_NONE, this->tile, user_id)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableCreateSubsidy(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _CreateSubsidy_dispatch = MakeDispatchTableCreateSubsidy(std::make_index_sequence<_callback_tuple_size>{}); +bool CreateSubsidy::do_post(CommandCallback *callback) { + return _CreateSubsidy_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->cid, this->src_type, this->src, this->dst_type, this->dst); +} +bool CreateSubsidy::do_test() { + return (::Command::Do(DC_NONE, cid, src_type, src, dst_type, dst)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableScrollViewport(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _ScrollViewport_dispatch = MakeDispatchTableScrollViewport(std::make_index_sequence<_callback_tuple_size>{}); +bool ScrollViewport::do_post(CommandCallback *callback) { + return _ScrollViewport_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->target, this->ref); +} +bool ScrollViewport::do_test() { + return (::Command::Do(DC_NONE, this->tile, target, ref)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuyShareInCompany(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuyShareInCompany_dispatch = MakeDispatchTableBuyShareInCompany(std::make_index_sequence<_callback_tuple_size>{}); +bool BuyShareInCompany::do_post(CommandCallback *callback) { + return _BuyShareInCompany_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->target_company); +} +bool BuyShareInCompany::do_test() { + return (::Command::Do(DC_NONE, target_company)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableSellShareInCompany(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _SellShareInCompany_dispatch = MakeDispatchTableSellShareInCompany(std::make_index_sequence<_callback_tuple_size>{}); +bool SellShareInCompany::do_post(CommandCallback *callback) { + return _SellShareInCompany_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->target_company); +} +bool SellShareInCompany::do_test() { + return (::Command::Do(DC_NONE, target_company)).Succeeded(); +} + +template +inline constexpr auto MakeDispatchTableBuyCompany(std::index_sequence) noexcept +{ + return std::array{MakeCallback()... }; +} +static constexpr auto _BuyCompany_dispatch = MakeDispatchTableBuyCompany(std::make_index_sequence<_callback_tuple_size>{}); +bool BuyCompany::do_post(CommandCallback *callback) { + return _BuyCompany_dispatch[FindCallbackIndex(callback)](this->error, this->tile, this->target_company); +} +bool BuyCompany::do_test() { + return (::Command::Do(DC_NONE, target_company)).Succeeded(); } } // namespace cmd diff --git a/src/citymania/generated/cm_gen_commands.hpp b/src/citymania/generated/cm_gen_commands.hpp index 1c60213d8a..716c53a97a 100644 --- a/src/citymania/generated/cm_gen_commands.hpp +++ b/src/citymania/generated/cm_gen_commands.hpp @@ -3,217 +3,1113 @@ #ifndef CM_GEN_COMMANDS_HPP #define CM_GEN_COMMANDS_HPP #include "../cm_command_type.hpp" +#include "../../dock_cmd.h" +#include "../../goal_cmd.h" +#include "../../news_cmd.h" +#include "../../story_cmd.h" +#include "../../vehicle_cmd.h" +#include "../../settings_cmd.h" +#include "../../group_cmd.h" +#include "../../airport_cmd.h" +#include "../../roadveh_cmd.h" +#include "../../timetable_cmd.h" +#include "../../engine_cmd.h" +#include "../../ship_cmd.h" +#include "../../tree_cmd.h" +#include "../../landscape_cmd.h" +#include "../../station_cmd.h" +#include "../../company_cmd.h" +#include "../../depot_cmd.h" +#include "../../autoreplace_cmd.h" +#include "../../tile_cmd.h" +#include "../../water_cmd.h" +#include "../../road_cmd.h" +#include "../../rail_cmd.h" +#include "../../industry_cmd.h" +#include "../../waypoint_cmd.h" +#include "../../town_cmd.h" +#include "../../object_cmd.h" +#include "../../train_cmd.h" +#include "../../signs_cmd.h" +#include "../../tunnelbridge_cmd.h" +#include "../../terraform_cmd.h" +#include "../../misc_cmd.h" +#include "../../order_cmd.h" +#include "../../subsidy_cmd.h" +#include "../../viewport_cmd.h" +#include "../../economy_cmd.h" +#include "../../aircraft_cmd.h" + namespace citymania { namespace cmd { -class MoneyCheat: public Command { +class CreateGoal: public Command { public: - Money amount; - - MoneyCheat(Money amount) - :amount{amount} {} - ~MoneyCheat() override {} - - bool DoPost() override; - bool DoTest() override; -}; - -class ChangeBankBalance: public Command { -public: - Money delta; CompanyID company; - ExpensesType expenses_type; + GoalType type; + GoalTypeID dest; + const std::string &text; - ChangeBankBalance(Money delta, CompanyID company, ExpensesType expenses_type) - :delta{delta}, company{company}, expenses_type{expenses_type} {} - ChangeBankBalance(TileIndex tile, Money delta, CompanyID company, ExpensesType expenses_type) - :Command{tile}, delta{delta}, company{company}, expenses_type{expenses_type} {} - ~ChangeBankBalance() override {} + CreateGoal(CompanyID company, GoalType type, GoalTypeID dest, const std::string &text) + :company{company}, type{type}, dest{dest}, text{text} {} + ~CreateGoal() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class IncreaseLoan: public Command { +class RemoveGoal: public Command { public: - LoanCommand cmd; - Money amount; + GoalID goal; - IncreaseLoan(LoanCommand cmd, Money amount) - :cmd{cmd}, amount{amount} {} - ~IncreaseLoan() override {} + RemoveGoal(GoalID goal) + :goal{goal} {} + ~RemoveGoal() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class DecreaseLoan: public Command { +class SetGoalText: public Command { public: - LoanCommand cmd; - Money amount; + GoalID goal; + const std::string &text; - DecreaseLoan(LoanCommand cmd, Money amount) - :cmd{cmd}, amount{amount} {} - ~DecreaseLoan() override {} + SetGoalText(GoalID goal, const std::string &text) + :goal{goal}, text{text} {} + ~SetGoalText() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class Pause: public Command { +class SetGoalProgress: public Command { public: - PauseMode mode; - bool pause; + GoalID goal; + const std::string &text; - Pause(PauseMode mode, bool pause) - :mode{mode}, pause{pause} {} - ~Pause() override {} + SetGoalProgress(GoalID goal, const std::string &text) + :goal{goal}, text{text} {} + ~SetGoalProgress() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class BuildObject: public Command { +class SetGoalCompleted: public Command { public: - ObjectType type; - uint8 view; + GoalID goal; + bool completed; - BuildObject(ObjectType type, uint8 view) - :type{type}, view{view} {} - BuildObject(TileIndex tile, ObjectType type, uint8 view) - :Command{tile}, type{type}, view{view} {} - ~BuildObject() override {} + SetGoalCompleted(GoalID goal, bool completed) + :goal{goal}, completed{completed} {} + ~SetGoalCompleted() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class BuildObjectArea: public Command { +class GoalQuestion: public Command { public: - TileIndex start_tile; - ObjectType type; - uint8 view; - bool diagonal; + uint16 uniqueid; + uint16 target; + bool is_client; + uint32 button_mask; + GoalQuestionType type; + const std::string &text; - BuildObjectArea(TileIndex start_tile, ObjectType type, uint8 view, bool diagonal) - :start_tile{start_tile}, type{type}, view{view}, diagonal{diagonal} {} - BuildObjectArea(TileIndex tile, TileIndex start_tile, ObjectType type, uint8 view, bool diagonal) - :Command{tile}, start_tile{start_tile}, type{type}, view{view}, diagonal{diagonal} {} - ~BuildObjectArea() override {} + GoalQuestion(uint16 uniqueid, uint16 target, bool is_client, uint32 button_mask, GoalQuestionType type, const std::string &text) + :uniqueid{uniqueid}, target{target}, is_client{is_client}, button_mask{button_mask}, type{type}, text{text} {} + ~GoalQuestion() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class ModifyOrder: public Command { +class GoalQuestionAnswer: public Command { public: - VehicleID veh; - VehicleOrderID sel_ord; - ModifyOrderFlags mof; - uint16 data; + uint16 uniqueid; + uint8 button; - ModifyOrder(VehicleID veh, VehicleOrderID sel_ord, ModifyOrderFlags mof, uint16 data) - :veh{veh}, sel_ord{sel_ord}, mof{mof}, data{data} {} - ~ModifyOrder() override {} + GoalQuestionAnswer(uint16 uniqueid, uint8 button) + :uniqueid{uniqueid}, button{button} {} + ~GoalQuestionAnswer() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class SkipToOrder: public Command { +class CustomNewsItem: public Command { +public: + NewsType type; + NewsReferenceType reftype1; + CompanyID company; + uint32 reference; + const std::string &text; + + CustomNewsItem(NewsType type, NewsReferenceType reftype1, CompanyID company, uint32 reference, const std::string &text) + :type{type}, reftype1{reftype1}, company{company}, reference{reference}, text{text} {} + ~CustomNewsItem() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class CreateStoryPage: public Command { +public: + CompanyID company; + const std::string &text; + + CreateStoryPage(CompanyID company, const std::string &text) + :company{company}, text{text} {} + ~CreateStoryPage() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class CreateStoryPageElement: public Command { +public: + StoryPageID page_id; + StoryPageElementType type; + uint32 reference; + const std::string &text; + + CreateStoryPageElement(StoryPageID page_id, StoryPageElementType type, uint32 reference, const std::string &text) + :page_id{page_id}, type{type}, reference{reference}, text{text} {} + CreateStoryPageElement(TileIndex tile, StoryPageID page_id, StoryPageElementType type, uint32 reference, const std::string &text) + :Command{tile}, page_id{page_id}, type{type}, reference{reference}, text{text} {} + ~CreateStoryPageElement() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class UpdateStoryPageElement: public Command { +public: + StoryPageElementID page_element_id; + uint32 reference; + const std::string &text; + + UpdateStoryPageElement(StoryPageElementID page_element_id, uint32 reference, const std::string &text) + :page_element_id{page_element_id}, reference{reference}, text{text} {} + UpdateStoryPageElement(TileIndex tile, StoryPageElementID page_element_id, uint32 reference, const std::string &text) + :Command{tile}, page_element_id{page_element_id}, reference{reference}, text{text} {} + ~UpdateStoryPageElement() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SetStoryPageTitle: public Command { +public: + StoryPageID page_id; + const std::string &text; + + SetStoryPageTitle(StoryPageID page_id, const std::string &text) + :page_id{page_id}, text{text} {} + ~SetStoryPageTitle() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SetStoryPageDate: public Command { +public: + StoryPageID page_id; + Date date; + + SetStoryPageDate(StoryPageID page_id, Date date) + :page_id{page_id}, date{date} {} + ~SetStoryPageDate() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ShowStoryPage: public Command { +public: + StoryPageID page_id; + + ShowStoryPage(StoryPageID page_id) + :page_id{page_id} {} + ~ShowStoryPage() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RemoveStoryPage: public Command { +public: + StoryPageID page_id; + + RemoveStoryPage(StoryPageID page_id) + :page_id{page_id} {} + ~RemoveStoryPage() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RemoveStoryPageElement: public Command { +public: + StoryPageElementID page_element_id; + + RemoveStoryPageElement(StoryPageElementID page_element_id) + :page_element_id{page_element_id} {} + ~RemoveStoryPageElement() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class StoryPageButton: public Command { +public: + StoryPageElementID page_element_id; + VehicleID reference; + + StoryPageButton(StoryPageElementID page_element_id, VehicleID reference) + :page_element_id{page_element_id}, reference{reference} {} + StoryPageButton(TileIndex tile, StoryPageElementID page_element_id, VehicleID reference) + :Command{tile}, page_element_id{page_element_id}, reference{reference} {} + ~StoryPageButton() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildVehicle: public Command { +public: + EngineID eid; + bool use_free_vehicles; + CargoID cargo; + ClientID client_id; + + BuildVehicle(EngineID eid, bool use_free_vehicles, CargoID cargo, ClientID client_id) + :eid{eid}, use_free_vehicles{use_free_vehicles}, cargo{cargo}, client_id{client_id} {} + BuildVehicle(TileIndex tile, EngineID eid, bool use_free_vehicles, CargoID cargo, ClientID client_id) + :Command{tile}, eid{eid}, use_free_vehicles{use_free_vehicles}, cargo{cargo}, client_id{client_id} {} + ~BuildVehicle() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SellVehicle: public Command { +public: + VehicleID v_id; + bool sell_chain; + bool backup_order; + ClientID client_id; + + SellVehicle(VehicleID v_id, bool sell_chain, bool backup_order, ClientID client_id) + :v_id{v_id}, sell_chain{sell_chain}, backup_order{backup_order}, client_id{client_id} {} + ~SellVehicle() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RefitVehicle: public Command { public: VehicleID veh_id; - VehicleOrderID sel_ord; + CargoID new_cid; + byte new_subtype; + bool auto_refit; + bool only_this; + uint8 num_vehicles; - SkipToOrder(VehicleID veh_id, VehicleOrderID sel_ord) - :veh_id{veh_id}, sel_ord{sel_ord} {} - ~SkipToOrder() override {} + RefitVehicle(VehicleID veh_id, CargoID new_cid, byte new_subtype, bool auto_refit, bool only_this, uint8 num_vehicles) + :veh_id{veh_id}, new_cid{new_cid}, new_subtype{new_subtype}, auto_refit{auto_refit}, only_this{only_this}, num_vehicles{num_vehicles} {} + ~RefitVehicle() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class DeleteOrder: public Command { +class SendVehicleToDepot: public Command { public: VehicleID veh_id; - VehicleOrderID sel_ord; + DepotCommand depot_cmd; + const VehicleListIdentifier &vli; - DeleteOrder(VehicleID veh_id, VehicleOrderID sel_ord) - :veh_id{veh_id}, sel_ord{sel_ord} {} - ~DeleteOrder() override {} + SendVehicleToDepot(VehicleID veh_id, DepotCommand depot_cmd, const VehicleListIdentifier &vli) + :veh_id{veh_id}, depot_cmd{depot_cmd}, vli{vli} {} + ~SendVehicleToDepot() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class InsertOrder: public Command { +class ChangeServiceInt: public Command { public: - VehicleID veh; - VehicleOrderID sel_ord; - const Order &new_order; + VehicleID veh_id; + uint16 serv_int; + bool is_custom; + bool is_percent; - InsertOrder(VehicleID veh, VehicleOrderID sel_ord, const Order &new_order) - :veh{veh}, sel_ord{sel_ord}, new_order{new_order} {} - ~InsertOrder() override {} + ChangeServiceInt(VehicleID veh_id, uint16 serv_int, bool is_custom, bool is_percent) + :veh_id{veh_id}, serv_int{serv_int}, is_custom{is_custom}, is_percent{is_percent} {} + ~ChangeServiceInt() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class OrderRefit: public Command { +class RenameVehicle: public Command { +public: + VehicleID veh_id; + const std::string &text; + + RenameVehicle(VehicleID veh_id, const std::string &text) + :veh_id{veh_id}, text{text} {} + ~RenameVehicle() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class CloneVehicle: public Command { +public: + VehicleID veh_id; + bool share_orders; + + CloneVehicle(VehicleID veh_id, bool share_orders) + :veh_id{veh_id}, share_orders{share_orders} {} + CloneVehicle(TileIndex tile, VehicleID veh_id, bool share_orders) + :Command{tile}, veh_id{veh_id}, share_orders{share_orders} {} + ~CloneVehicle() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class StartStopVehicle: public Command { +public: + VehicleID veh_id; + bool evaluate_startstop_cb; + + StartStopVehicle(VehicleID veh_id, bool evaluate_startstop_cb) + :veh_id{veh_id}, evaluate_startstop_cb{evaluate_startstop_cb} {} + ~StartStopVehicle() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class MassStartStopVehicle: public Command { +public: + bool do_start; + bool vehicle_list_window; + const VehicleListIdentifier &vli; + + MassStartStopVehicle(bool do_start, bool vehicle_list_window, const VehicleListIdentifier &vli) + :do_start{do_start}, vehicle_list_window{vehicle_list_window}, vli{vli} {} + MassStartStopVehicle(TileIndex tile, bool do_start, bool vehicle_list_window, const VehicleListIdentifier &vli) + :Command{tile}, do_start{do_start}, vehicle_list_window{vehicle_list_window}, vli{vli} {} + ~MassStartStopVehicle() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class DepotSellAllVehicles: public Command { +public: + VehicleType vehicle_type; + + DepotSellAllVehicles(VehicleType vehicle_type) + :vehicle_type{vehicle_type} {} + DepotSellAllVehicles(TileIndex tile, VehicleType vehicle_type) + :Command{tile}, vehicle_type{vehicle_type} {} + ~DepotSellAllVehicles() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class DepotMassAutoReplace: public Command { +public: + VehicleType vehicle_type; + + DepotMassAutoReplace(VehicleType vehicle_type) + :vehicle_type{vehicle_type} {} + DepotMassAutoReplace(TileIndex tile, VehicleType vehicle_type) + :Command{tile}, vehicle_type{vehicle_type} {} + ~DepotMassAutoReplace() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ChangeSetting: public Command { +public: + const std::string &name; + int32 value; + + ChangeSetting(const std::string &name, int32 value) + :name{name}, value{value} {} + ~ChangeSetting() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ChangeCompanySetting: public Command { +public: + const std::string &name; + int32 value; + + ChangeCompanySetting(const std::string &name, int32 value) + :name{name}, value{value} {} + ~ChangeCompanySetting() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class CreateGroup: public Command { +public: + VehicleType vt; + GroupID parent_group; + + CreateGroup(VehicleType vt, GroupID parent_group) + :vt{vt}, parent_group{parent_group} {} + ~CreateGroup() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class AlterGroup: public Command { +public: + AlterGroupMode mode; + GroupID group_id; + GroupID parent_id; + const std::string &text; + + AlterGroup(AlterGroupMode mode, GroupID group_id, GroupID parent_id, const std::string &text) + :mode{mode}, group_id{group_id}, parent_id{parent_id}, text{text} {} + ~AlterGroup() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class DeleteGroup: public Command { +public: + GroupID group_id; + + DeleteGroup(GroupID group_id) + :group_id{group_id} {} + ~DeleteGroup() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class AddVehicleGroup: public Command { +public: + GroupID group_id; + VehicleID veh_id; + bool add_shared; + + AddVehicleGroup(GroupID group_id, VehicleID veh_id, bool add_shared) + :group_id{group_id}, veh_id{veh_id}, add_shared{add_shared} {} + ~AddVehicleGroup() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class AddSharedVehicleGroup: public Command { +public: + GroupID id_g; + VehicleType type; + + AddSharedVehicleGroup(GroupID id_g, VehicleType type) + :id_g{id_g}, type{type} {} + ~AddSharedVehicleGroup() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RemoveAllVehiclesGroup: public Command { +public: + GroupID group_id; + + RemoveAllVehiclesGroup(GroupID group_id) + :group_id{group_id} {} + ~RemoveAllVehiclesGroup() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SetGroupFlag: public Command { +public: + GroupID group_id; + GroupFlags flag; + bool value; + bool recursive; + + SetGroupFlag(GroupID group_id, GroupFlags flag, bool value, bool recursive) + :group_id{group_id}, flag{flag}, value{value}, recursive{recursive} {} + ~SetGroupFlag() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SetGroupLivery: public Command { +public: + GroupID group_id; + bool primary; + Colours colour; + + SetGroupLivery(GroupID group_id, bool primary, Colours colour) + :group_id{group_id}, primary{primary}, colour{colour} {} + ~SetGroupLivery() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class TurnRoadVeh: public Command { +public: + VehicleID veh_id; + + TurnRoadVeh(VehicleID veh_id) + :veh_id{veh_id} {} + ~TurnRoadVeh() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ChangeTimetable: public Command { public: VehicleID veh; VehicleOrderID order_number; - CargoID cargo; + ModifyTimetableFlags mtf; + uint16 data; - OrderRefit(VehicleID veh, VehicleOrderID order_number, CargoID cargo) - :veh{veh}, order_number{order_number}, cargo{cargo} {} - ~OrderRefit() override {} + ChangeTimetable(VehicleID veh, VehicleOrderID order_number, ModifyTimetableFlags mtf, uint16 data) + :veh{veh}, order_number{order_number}, mtf{mtf}, data{data} {} + ~ChangeTimetable() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class CloneOrder: public Command { -public: - CloneOptions action; - VehicleID veh_dst; - VehicleID veh_src; - - CloneOrder(CloneOptions action, VehicleID veh_dst, VehicleID veh_src) - :action{action}, veh_dst{veh_dst}, veh_src{veh_src} {} - ~CloneOrder() override {} - - bool DoPost() override; - bool DoTest() override; -}; - -class MoveOrder: public Command { +class SetVehicleOnTime: public Command { public: VehicleID veh; - VehicleOrderID moving_order; - VehicleOrderID target_order; - MoveOrder(VehicleID veh, VehicleOrderID moving_order, VehicleOrderID target_order) - :veh{veh}, moving_order{moving_order}, target_order{target_order} {} - ~MoveOrder() override {} + SetVehicleOnTime(VehicleID veh) + :veh{veh} {} + ~SetVehicleOnTime() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class ClearOrderBackup: public Command { +class AutofillTimetable: public Command { public: - ClientID user_id; + VehicleID veh; + bool autofill; + bool preserve_wait_time; - ClearOrderBackup(ClientID user_id) - :user_id{user_id} {} - ClearOrderBackup(TileIndex tile, ClientID user_id) - :Command{tile}, user_id{user_id} {} - ~ClearOrderBackup() override {} + AutofillTimetable(VehicleID veh, bool autofill, bool preserve_wait_time) + :veh{veh}, autofill{autofill}, preserve_wait_time{preserve_wait_time} {} + ~AutofillTimetable() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SetTimetableStart: public Command { +public: + VehicleID veh_id; + bool timetable_all; + Date start_date; + + SetTimetableStart(VehicleID veh_id, bool timetable_all, Date start_date) + :veh_id{veh_id}, timetable_all{timetable_all}, start_date{start_date} {} + ~SetTimetableStart() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class WantEnginePreview: public Command { +public: + EngineID engine_id; + + WantEnginePreview(EngineID engine_id) + :engine_id{engine_id} {} + ~WantEnginePreview() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class EngineCtrl: public Command { +public: + EngineID engine_id; + CompanyID company_id; + bool allow; + + EngineCtrl(EngineID engine_id, CompanyID company_id, bool allow) + :engine_id{engine_id}, company_id{company_id}, allow{allow} {} + ~EngineCtrl() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RenameEngine: public Command { +public: + EngineID engine_id; + const std::string &text; + + RenameEngine(EngineID engine_id, const std::string &text) + :engine_id{engine_id}, text{text} {} + ~RenameEngine() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SetVehicleVisibility: public Command { +public: + EngineID engine_id; + bool hide; + + SetVehicleVisibility(EngineID engine_id, bool hide) + :engine_id{engine_id}, hide{hide} {} + ~SetVehicleVisibility() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class PlantTree: public Command { +public: + TileIndex start_tile; + byte tree_to_plant; + + PlantTree(TileIndex start_tile, byte tree_to_plant) + :start_tile{start_tile}, tree_to_plant{tree_to_plant} {} + PlantTree(TileIndex tile, TileIndex start_tile, byte tree_to_plant) + :Command{tile}, start_tile{start_tile}, tree_to_plant{tree_to_plant} {} + ~PlantTree() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class LandscapeClear: public Command { +public: + + LandscapeClear() {} + LandscapeClear(TileIndex tile) + :Command{tile} {} + ~LandscapeClear() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ClearArea: public Command { +public: + TileIndex start_tile; + bool diagonal; + + ClearArea(TileIndex start_tile, bool diagonal) + :start_tile{start_tile}, diagonal{diagonal} {} + ClearArea(TileIndex tile, TileIndex start_tile, bool diagonal) + :Command{tile}, start_tile{start_tile}, diagonal{diagonal} {} + ~ClearArea() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildAirport: public Command { +public: + byte airport_type; + byte layout; + StationID station_to_join; + bool adjacent; + + BuildAirport(byte airport_type, byte layout, StationID station_to_join, bool adjacent) + :airport_type{airport_type}, layout{layout}, station_to_join{station_to_join}, adjacent{adjacent} {} + BuildAirport(TileIndex tile, byte airport_type, byte layout, StationID station_to_join, bool adjacent) + :Command{tile}, airport_type{airport_type}, layout{layout}, station_to_join{station_to_join}, adjacent{adjacent} {} + ~BuildAirport() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildDock: public Command { +public: + StationID station_to_join; + bool adjacent; + + BuildDock(StationID station_to_join, bool adjacent) + :station_to_join{station_to_join}, adjacent{adjacent} {} + BuildDock(TileIndex tile, StationID station_to_join, bool adjacent) + :Command{tile}, station_to_join{station_to_join}, adjacent{adjacent} {} + ~BuildDock() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildRailStation: public Command { +public: + RailType rt; + Axis axis; + byte numtracks; + byte plat_len; + StationClassID spec_class; + byte spec_index; + StationID station_to_join; + bool adjacent; + + BuildRailStation(RailType rt, Axis axis, byte numtracks, byte plat_len, StationClassID spec_class, byte spec_index, StationID station_to_join, bool adjacent) + :rt{rt}, axis{axis}, numtracks{numtracks}, plat_len{plat_len}, spec_class{spec_class}, spec_index{spec_index}, station_to_join{station_to_join}, adjacent{adjacent} {} + BuildRailStation(TileIndex tile, RailType rt, Axis axis, byte numtracks, byte plat_len, StationClassID spec_class, byte spec_index, StationID station_to_join, bool adjacent) + :Command{tile}, rt{rt}, axis{axis}, numtracks{numtracks}, plat_len{plat_len}, spec_class{spec_class}, spec_index{spec_index}, station_to_join{station_to_join}, adjacent{adjacent} {} + ~BuildRailStation() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RemoveFromRailStation: public Command { +public: + TileIndex end; + bool keep_rail; + + RemoveFromRailStation(TileIndex end, bool keep_rail) + :end{end}, keep_rail{keep_rail} {} + RemoveFromRailStation(TileIndex tile, TileIndex end, bool keep_rail) + :Command{tile}, end{end}, keep_rail{keep_rail} {} + ~RemoveFromRailStation() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildRoadStop: public Command { +public: + uint8 width; + uint8 length; + RoadStopType stop_type; + bool is_drive_through; + DiagDirection ddir; + RoadType rt; + StationID station_to_join; + bool adjacent; + + BuildRoadStop(uint8 width, uint8 length, RoadStopType stop_type, bool is_drive_through, DiagDirection ddir, RoadType rt, StationID station_to_join, bool adjacent) + :width{width}, length{length}, stop_type{stop_type}, is_drive_through{is_drive_through}, ddir{ddir}, rt{rt}, station_to_join{station_to_join}, adjacent{adjacent} {} + BuildRoadStop(TileIndex tile, uint8 width, uint8 length, RoadStopType stop_type, bool is_drive_through, DiagDirection ddir, RoadType rt, StationID station_to_join, bool adjacent) + :Command{tile}, width{width}, length{length}, stop_type{stop_type}, is_drive_through{is_drive_through}, ddir{ddir}, rt{rt}, station_to_join{station_to_join}, adjacent{adjacent} {} + ~BuildRoadStop() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RemoveRoadStop: public Command { +public: + uint8 width; + uint8 height; + RoadStopType stop_type; + bool remove_road; + + RemoveRoadStop(uint8 width, uint8 height, RoadStopType stop_type, bool remove_road) + :width{width}, height{height}, stop_type{stop_type}, remove_road{remove_road} {} + RemoveRoadStop(TileIndex tile, uint8 width, uint8 height, RoadStopType stop_type, bool remove_road) + :Command{tile}, width{width}, height{height}, stop_type{stop_type}, remove_road{remove_road} {} + ~RemoveRoadStop() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RenameStation: public Command { +public: + StationID station_id; + const std::string &text; + + RenameStation(StationID station_id, const std::string &text) + :station_id{station_id}, text{text} {} + ~RenameStation() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class OpenCloseAirport: public Command { +public: + StationID station_id; + + OpenCloseAirport(StationID station_id) + :station_id{station_id} {} + ~OpenCloseAirport() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class CompanyCtrl: public Command { +public: + CompanyCtrlAction cca; + CompanyID company_id; + CompanyRemoveReason reason; + ClientID client_id; + + CompanyCtrl(CompanyCtrlAction cca, CompanyID company_id, CompanyRemoveReason reason, ClientID client_id) + :cca{cca}, company_id{company_id}, reason{reason}, client_id{client_id} {} + ~CompanyCtrl() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class GiveMoney: public Command { +public: + uint32 money; + CompanyID dest_company; + + GiveMoney(uint32 money, CompanyID dest_company) + :money{money}, dest_company{dest_company} {} + ~GiveMoney() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RenameCompany: public Command { +public: + const std::string &text; + + RenameCompany(const std::string &text) + :text{text} {} + ~RenameCompany() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RenamePresident: public Command { +public: + const std::string &text; + + RenamePresident(const std::string &text) + :text{text} {} + ~RenamePresident() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SetCompanyManagerFace: public Command { +public: + CompanyManagerFace cmf; + + SetCompanyManagerFace(CompanyManagerFace cmf) + :cmf{cmf} {} + ~SetCompanyManagerFace() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SetCompanyColour: public Command { +public: + LiveryScheme scheme; + bool primary; + Colours colour; + + SetCompanyColour(LiveryScheme scheme, bool primary, Colours colour) + :scheme{scheme}, primary{primary}, colour{colour} {} + ~SetCompanyColour() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RenameDepot: public Command { +public: + DepotID depot_id; + const std::string &text; + + RenameDepot(DepotID depot_id, const std::string &text) + :depot_id{depot_id}, text{text} {} + ~RenameDepot() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class AutoreplaceVehicle: public Command { +public: + VehicleID veh_id; + + AutoreplaceVehicle(VehicleID veh_id) + :veh_id{veh_id} {} + ~AutoreplaceVehicle() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SetAutoReplace: public Command { +public: + GroupID id_g; + EngineID old_engine_type; + EngineID new_engine_type; + bool when_old; + + SetAutoReplace(GroupID id_g, EngineID old_engine_type, EngineID new_engine_type, bool when_old) + :id_g{id_g}, old_engine_type{old_engine_type}, new_engine_type{new_engine_type}, when_old{when_old} {} + ~SetAutoReplace() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildShipDepot: public Command { +public: + Axis axis; + + BuildShipDepot(Axis axis) + :axis{axis} {} + BuildShipDepot(TileIndex tile, Axis axis) + :Command{tile}, axis{axis} {} + ~BuildShipDepot() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildCanal: public Command { +public: + TileIndex start_tile; + WaterClass wc; + bool diagonal; + + BuildCanal(TileIndex start_tile, WaterClass wc, bool diagonal) + :start_tile{start_tile}, wc{wc}, diagonal{diagonal} {} + BuildCanal(TileIndex tile, TileIndex start_tile, WaterClass wc, bool diagonal) + :Command{tile}, start_tile{start_tile}, wc{wc}, diagonal{diagonal} {} + ~BuildCanal() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildLock: public Command { +public: + + BuildLock() {} + BuildLock(TileIndex tile) + :Command{tile} {} + ~BuildLock() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildLongRoad: public Command { +public: + TileIndex start_tile; + RoadType rt; + Axis axis; + DisallowedRoadDirections drd; + bool start_half; + bool end_half; + bool is_ai; + + BuildLongRoad(TileIndex start_tile, RoadType rt, Axis axis, DisallowedRoadDirections drd, bool start_half, bool end_half, bool is_ai) + :start_tile{start_tile}, rt{rt}, axis{axis}, drd{drd}, start_half{start_half}, end_half{end_half}, is_ai{is_ai} {} + BuildLongRoad(TileIndex tile, TileIndex start_tile, RoadType rt, Axis axis, DisallowedRoadDirections drd, bool start_half, bool end_half, bool is_ai) + :Command{tile}, start_tile{start_tile}, rt{rt}, axis{axis}, drd{drd}, start_half{start_half}, end_half{end_half}, is_ai{is_ai} {} + ~BuildLongRoad() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RemoveLongRoad: public Command { +public: + TileIndex start_tile; + RoadType rt; + Axis axis; + bool start_half; + bool end_half; + + RemoveLongRoad(TileIndex start_tile, RoadType rt, Axis axis, bool start_half, bool end_half) + :start_tile{start_tile}, rt{rt}, axis{axis}, start_half{start_half}, end_half{end_half} {} + RemoveLongRoad(TileIndex tile, TileIndex start_tile, RoadType rt, Axis axis, bool start_half, bool end_half) + :Command{tile}, start_tile{start_tile}, rt{rt}, axis{axis}, start_half{start_half}, end_half{end_half} {} + ~RemoveLongRoad() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildRoad: public Command { +public: + RoadBits pieces; + RoadType rt; + DisallowedRoadDirections toggle_drd; + TownID town_id; + + BuildRoad(RoadBits pieces, RoadType rt, DisallowedRoadDirections toggle_drd, TownID town_id) + :pieces{pieces}, rt{rt}, toggle_drd{toggle_drd}, town_id{town_id} {} + BuildRoad(TileIndex tile, RoadBits pieces, RoadType rt, DisallowedRoadDirections toggle_drd, TownID town_id) + :Command{tile}, pieces{pieces}, rt{rt}, toggle_drd{toggle_drd}, town_id{town_id} {} + ~BuildRoad() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildRoadDepot: public Command { +public: + RoadType rt; + DiagDirection dir; + + BuildRoadDepot(RoadType rt, DiagDirection dir) + :rt{rt}, dir{dir} {} + BuildRoadDepot(TileIndex tile, RoadType rt, DiagDirection dir) + :Command{tile}, rt{rt}, dir{dir} {} + ~BuildRoadDepot() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ConvertRoad: public Command { +public: + TileIndex area_start; + RoadType to_type; + + ConvertRoad(TileIndex area_start, RoadType to_type) + :area_start{area_start}, to_type{to_type} {} + ConvertRoad(TileIndex tile, TileIndex area_start, RoadType to_type) + :Command{tile}, area_start{area_start}, to_type{to_type} {} + ~ConvertRoad() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class BuildRailroadTrack: public Command { @@ -230,8 +1126,8 @@ public: :Command{tile}, start_tile{start_tile}, railtype{railtype}, track{track}, auto_remove_signals{auto_remove_signals}, fail_on_obstacle{fail_on_obstacle} {} ~BuildRailroadTrack() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class RemoveRailroadTrack: public Command { @@ -245,8 +1141,8 @@ public: :Command{tile}, start_tile{start_tile}, track{track} {} ~RemoveRailroadTrack() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class BuildSingleRail: public Command { @@ -261,8 +1157,8 @@ public: :Command{tile}, railtype{railtype}, track{track}, auto_remove_signals{auto_remove_signals} {} ~BuildSingleRail() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class RemoveSingleRail: public Command { @@ -275,8 +1171,8 @@ public: :Command{tile}, track{track} {} ~RemoveSingleRail() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class BuildTrainDepot: public Command { @@ -290,8 +1186,8 @@ public: :Command{tile}, railtype{railtype}, dir{dir} {} ~BuildTrainDepot() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class BuildSingleSignal: public Command { @@ -313,8 +1209,8 @@ public: :Command{tile}, track{track}, sigtype{sigtype}, sigvar{sigvar}, convert_signal{convert_signal}, skip_existing_signals{skip_existing_signals}, ctrl_pressed{ctrl_pressed}, cycle_start{cycle_start}, cycle_stop{cycle_stop}, num_dir_cycle{num_dir_cycle}, signals_copy{signals_copy} {} ~BuildSingleSignal() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class RemoveSingleSignal: public Command { @@ -327,8 +1223,8 @@ public: :Command{tile}, track{track} {} ~RemoveSingleSignal() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class ConvertRail: public Command { @@ -343,8 +1239,8 @@ public: :Command{tile}, area_start{area_start}, totype{totype}, diagonal{diagonal} {} ~ConvertRail() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class BuildSignalTrack: public Command { @@ -364,8 +1260,8 @@ public: :Command{tile}, end_tile{end_tile}, track{track}, sigtype{sigtype}, sigvar{sigvar}, mode{mode}, autofill{autofill}, minimise_gaps{minimise_gaps}, signal_density{signal_density} {} ~BuildSignalTrack() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class RemoveSignalTrack: public Command { @@ -380,224 +1276,101 @@ public: :Command{tile}, end_tile{end_tile}, track{track}, autofill{autofill} {} ~RemoveSignalTrack() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class BuildLongRoad: public Command { +class BuildIndustry: public Command { +public: + IndustryType it; + uint32 first_layout; + bool fund; + uint32 seed; + + BuildIndustry(IndustryType it, uint32 first_layout, bool fund, uint32 seed) + :it{it}, first_layout{first_layout}, fund{fund}, seed{seed} {} + BuildIndustry(TileIndex tile, IndustryType it, uint32 first_layout, bool fund, uint32 seed) + :Command{tile}, it{it}, first_layout{first_layout}, fund{fund}, seed{seed} {} + ~BuildIndustry() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class IndustryCtrl: public Command { +public: + IndustryID ind_id; + IndustryAction action; + IndustryControlFlags ctlflags; + Owner company_id; + const std::string &text; + + IndustryCtrl(IndustryID ind_id, IndustryAction action, IndustryControlFlags ctlflags, Owner company_id, const std::string &text) + :ind_id{ind_id}, action{action}, ctlflags{ctlflags}, company_id{company_id}, text{text} {} + ~IndustryCtrl() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildRailWaypoint: public Command { public: - TileIndex start_tile; - RoadType rt; Axis axis; - DisallowedRoadDirections drd; - bool start_half; - bool end_half; - bool is_ai; - - BuildLongRoad(TileIndex start_tile, RoadType rt, Axis axis, DisallowedRoadDirections drd, bool start_half, bool end_half, bool is_ai) - :start_tile{start_tile}, rt{rt}, axis{axis}, drd{drd}, start_half{start_half}, end_half{end_half}, is_ai{is_ai} {} - BuildLongRoad(TileIndex tile, TileIndex start_tile, RoadType rt, Axis axis, DisallowedRoadDirections drd, bool start_half, bool end_half, bool is_ai) - :Command{tile}, start_tile{start_tile}, rt{rt}, axis{axis}, drd{drd}, start_half{start_half}, end_half{end_half}, is_ai{is_ai} {} - ~BuildLongRoad() override {} - - bool DoPost() override; - bool DoTest() override; -}; - -class RemoveLongRoad: public Command { -public: - TileIndex start_tile; - RoadType rt; - Axis axis; - bool start_half; - bool end_half; - - RemoveLongRoad(TileIndex start_tile, RoadType rt, Axis axis, bool start_half, bool end_half) - :start_tile{start_tile}, rt{rt}, axis{axis}, start_half{start_half}, end_half{end_half} {} - RemoveLongRoad(TileIndex tile, TileIndex start_tile, RoadType rt, Axis axis, bool start_half, bool end_half) - :Command{tile}, start_tile{start_tile}, rt{rt}, axis{axis}, start_half{start_half}, end_half{end_half} {} - ~RemoveLongRoad() override {} - - bool DoPost() override; - bool DoTest() override; -}; - -class BuildRoad: public Command { -public: - RoadBits pieces; - RoadType rt; - DisallowedRoadDirections toggle_drd; - TownID town_id; - - BuildRoad(RoadBits pieces, RoadType rt, DisallowedRoadDirections toggle_drd, TownID town_id) - :pieces{pieces}, rt{rt}, toggle_drd{toggle_drd}, town_id{town_id} {} - BuildRoad(TileIndex tile, RoadBits pieces, RoadType rt, DisallowedRoadDirections toggle_drd, TownID town_id) - :Command{tile}, pieces{pieces}, rt{rt}, toggle_drd{toggle_drd}, town_id{town_id} {} - ~BuildRoad() override {} - - bool DoPost() override; - bool DoTest() override; -}; - -class BuildRoadDepot: public Command { -public: - RoadType rt; - DiagDirection dir; - - BuildRoadDepot(RoadType rt, DiagDirection dir) - :rt{rt}, dir{dir} {} - BuildRoadDepot(TileIndex tile, RoadType rt, DiagDirection dir) - :Command{tile}, rt{rt}, dir{dir} {} - ~BuildRoadDepot() override {} - - bool DoPost() override; - bool DoTest() override; -}; - -class ConvertRoad: public Command { -public: - TileIndex area_start; - RoadType to_type; - - ConvertRoad(TileIndex area_start, RoadType to_type) - :area_start{area_start}, to_type{to_type} {} - ConvertRoad(TileIndex tile, TileIndex area_start, RoadType to_type) - :Command{tile}, area_start{area_start}, to_type{to_type} {} - ~ConvertRoad() override {} - - bool DoPost() override; - bool DoTest() override; -}; - -class BuildAirport: public Command { -public: - byte airport_type; - byte layout; - StationID station_to_join; - bool allow_adjacent; - - BuildAirport(byte airport_type, byte layout, StationID station_to_join, bool allow_adjacent) - :airport_type{airport_type}, layout{layout}, station_to_join{station_to_join}, allow_adjacent{allow_adjacent} {} - BuildAirport(TileIndex tile, byte airport_type, byte layout, StationID station_to_join, bool allow_adjacent) - :Command{tile}, airport_type{airport_type}, layout{layout}, station_to_join{station_to_join}, allow_adjacent{allow_adjacent} {} - ~BuildAirport() override {} - - bool DoPost() override; - bool DoTest() override; -}; - -class BuildDock: public Command { -public: - StationID station_to_join; - bool adjacent; - - BuildDock(StationID station_to_join, bool adjacent) - :station_to_join{station_to_join}, adjacent{adjacent} {} - BuildDock(TileIndex tile, StationID station_to_join, bool adjacent) - :Command{tile}, station_to_join{station_to_join}, adjacent{adjacent} {} - ~BuildDock() override {} - - bool DoPost() override; - bool DoTest() override; -}; - -class BuildRailStation: public Command { -public: - RailType rt; - Axis axis; - byte numtracks; - byte plat_len; + byte width; + byte height; StationClassID spec_class; byte spec_index; StationID station_to_join; bool adjacent; - BuildRailStation(RailType rt, Axis axis, byte numtracks, byte plat_len, StationClassID spec_class, byte spec_index, StationID station_to_join, bool adjacent) - :rt{rt}, axis{axis}, numtracks{numtracks}, plat_len{plat_len}, spec_class{spec_class}, spec_index{spec_index}, station_to_join{station_to_join}, adjacent{adjacent} {} - BuildRailStation(TileIndex tile, RailType rt, Axis axis, byte numtracks, byte plat_len, StationClassID spec_class, byte spec_index, StationID station_to_join, bool adjacent) - :Command{tile}, rt{rt}, axis{axis}, numtracks{numtracks}, plat_len{plat_len}, spec_class{spec_class}, spec_index{spec_index}, station_to_join{station_to_join}, adjacent{adjacent} {} - ~BuildRailStation() override {} + BuildRailWaypoint(Axis axis, byte width, byte height, StationClassID spec_class, byte spec_index, StationID station_to_join, bool adjacent) + :axis{axis}, width{width}, height{height}, spec_class{spec_class}, spec_index{spec_index}, station_to_join{station_to_join}, adjacent{adjacent} {} + BuildRailWaypoint(TileIndex tile, Axis axis, byte width, byte height, StationClassID spec_class, byte spec_index, StationID station_to_join, bool adjacent) + :Command{tile}, axis{axis}, width{width}, height{height}, spec_class{spec_class}, spec_index{spec_index}, station_to_join{station_to_join}, adjacent{adjacent} {} + ~BuildRailWaypoint() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class RemoveFromRailStation: public Command { +class RemoveFromRailWaypoint: public Command { public: TileIndex end; bool keep_rail; - RemoveFromRailStation(TileIndex end, bool keep_rail) + RemoveFromRailWaypoint(TileIndex end, bool keep_rail) :end{end}, keep_rail{keep_rail} {} - RemoveFromRailStation(TileIndex tile, TileIndex end, bool keep_rail) + RemoveFromRailWaypoint(TileIndex tile, TileIndex end, bool keep_rail) :Command{tile}, end{end}, keep_rail{keep_rail} {} - ~RemoveFromRailStation() override {} + ~RemoveFromRailWaypoint() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class BuildRoadStop: public Command { +class BuildBuoy: public Command { public: - uint8 width; - uint8 length; - RoadStopType stop_type; - bool is_drive_through; - DiagDirection ddir; - RoadType rt; - StationID station_to_join; - bool adjacent; - BuildRoadStop(uint8 width, uint8 length, RoadStopType stop_type, bool is_drive_through, DiagDirection ddir, RoadType rt, StationID station_to_join, bool adjacent) - :width{width}, length{length}, stop_type{stop_type}, is_drive_through{is_drive_through}, ddir{ddir}, rt{rt}, station_to_join{station_to_join}, adjacent{adjacent} {} - BuildRoadStop(TileIndex tile, uint8 width, uint8 length, RoadStopType stop_type, bool is_drive_through, DiagDirection ddir, RoadType rt, StationID station_to_join, bool adjacent) - :Command{tile}, width{width}, length{length}, stop_type{stop_type}, is_drive_through{is_drive_through}, ddir{ddir}, rt{rt}, station_to_join{station_to_join}, adjacent{adjacent} {} - ~BuildRoadStop() override {} + BuildBuoy() {} + BuildBuoy(TileIndex tile) + :Command{tile} {} + ~BuildBuoy() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; -class RemoveRoadStop: public Command { +class RenameWaypoint: public Command { public: - uint8 width; - uint8 height; - RoadStopType stop_type; - bool remove_road; - - RemoveRoadStop(uint8 width, uint8 height, RoadStopType stop_type, bool remove_road) - :width{width}, height{height}, stop_type{stop_type}, remove_road{remove_road} {} - RemoveRoadStop(TileIndex tile, uint8 width, uint8 height, RoadStopType stop_type, bool remove_road) - :Command{tile}, width{width}, height{height}, stop_type{stop_type}, remove_road{remove_road} {} - ~RemoveRoadStop() override {} - - bool DoPost() override; - bool DoTest() override; -}; - -class RenameStation: public Command { -public: - StationID station_id; + StationID waypoint_id; const std::string &text; - RenameStation(StationID station_id, const std::string &text) - :station_id{station_id}, text{text} {} - ~RenameStation() override {} + RenameWaypoint(StationID waypoint_id, const std::string &text) + :waypoint_id{waypoint_id}, text{text} {} + ~RenameWaypoint() override {} - bool DoPost() override; - bool DoTest() override; -}; - -class OpenCloseAirport: public Command { -public: - StationID station_id; - - OpenCloseAirport(StationID station_id) - :station_id{station_id} {} - ~OpenCloseAirport() override {} - - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class FoundTown: public Command { @@ -615,8 +1388,8 @@ public: :Command{tile}, size{size}, city{city}, layout{layout}, random_location{random_location}, townnameparts{townnameparts}, text{text} {} ~FoundTown() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class RenameTown: public Command { @@ -628,8 +1401,8 @@ public: :town_id{town_id}, text{text} {} ~RenameTown() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class DoTownAction: public Command { @@ -641,8 +1414,8 @@ public: :town_id{town_id}, action{action} {} ~DoTownAction() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class TownGrowthRate: public Command { @@ -654,8 +1427,8 @@ public: :town_id{town_id}, growth_rate{growth_rate} {} ~TownGrowthRate() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class TownRating: public Command { @@ -668,8 +1441,8 @@ public: :town_id{town_id}, company_id{company_id}, rating{rating} {} ~TownRating() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class TownCargoGoal: public Command { @@ -682,8 +1455,8 @@ public: :town_id{town_id}, te{te}, goal{goal} {} ~TownCargoGoal() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class TownSetText: public Command { @@ -695,8 +1468,8 @@ public: :town_id{town_id}, text{text} {} ~TownSetText() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class ExpandTown: public Command { @@ -708,8 +1481,8 @@ public: :town_id{town_id}, grow_amount{grow_amount} {} ~ExpandTown() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class DeleteTown: public Command { @@ -720,8 +1493,106 @@ public: :town_id{town_id} {} ~DeleteTown() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildObject: public Command { +public: + ObjectType type; + uint8 view; + + BuildObject(ObjectType type, uint8 view) + :type{type}, view{view} {} + BuildObject(TileIndex tile, ObjectType type, uint8 view) + :Command{tile}, type{type}, view{view} {} + ~BuildObject() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuildObjectArea: public Command { +public: + TileIndex start_tile; + ObjectType type; + uint8 view; + bool diagonal; + + BuildObjectArea(TileIndex start_tile, ObjectType type, uint8 view, bool diagonal) + :start_tile{start_tile}, type{type}, view{view}, diagonal{diagonal} {} + BuildObjectArea(TileIndex tile, TileIndex start_tile, ObjectType type, uint8 view, bool diagonal) + :Command{tile}, start_tile{start_tile}, type{type}, view{view}, diagonal{diagonal} {} + ~BuildObjectArea() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class MoveRailVehicle: public Command { +public: + VehicleID src_veh; + VehicleID dest_veh; + bool move_chain; + + MoveRailVehicle(VehicleID src_veh, VehicleID dest_veh, bool move_chain) + :src_veh{src_veh}, dest_veh{dest_veh}, move_chain{move_chain} {} + ~MoveRailVehicle() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ForceTrainProceed: public Command { +public: + VehicleID veh_id; + + ForceTrainProceed(VehicleID veh_id) + :veh_id{veh_id} {} + ~ForceTrainProceed() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ReverseTrainDirection: public Command { +public: + VehicleID veh_id; + bool reverse_single_veh; + + ReverseTrainDirection(VehicleID veh_id, bool reverse_single_veh) + :veh_id{veh_id}, reverse_single_veh{reverse_single_veh} {} + ~ReverseTrainDirection() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class PlaceSign: public Command { +public: + const std::string &text; + + PlaceSign(const std::string &text) + :text{text} {} + PlaceSign(TileIndex tile, const std::string &text) + :Command{tile}, text{text} {} + ~PlaceSign() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class RenameSign: public Command { +public: + SignID sign_id; + const std::string &text; + + RenameSign(SignID sign_id, const std::string &text) + :sign_id{sign_id}, text{text} {} + ~RenameSign() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class BuildBridge: public Command { @@ -737,8 +1608,8 @@ public: :Command{tile}, tile_start{tile_start}, transport_type{transport_type}, bridge_type{bridge_type}, road_rail_type{road_rail_type} {} ~BuildBridge() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; class BuildTunnel: public Command { @@ -752,8 +1623,284 @@ public: :Command{tile}, transport_type{transport_type}, road_rail_type{road_rail_type} {} ~BuildTunnel() override {} - bool DoPost() override; - bool DoTest() override; + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class TerraformLand: public Command { +public: + Slope slope; + bool dir_up; + + TerraformLand(Slope slope, bool dir_up) + :slope{slope}, dir_up{dir_up} {} + TerraformLand(TileIndex tile, Slope slope, bool dir_up) + :Command{tile}, slope{slope}, dir_up{dir_up} {} + ~TerraformLand() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class LevelLand: public Command { +public: + TileIndex start_tile; + bool diagonal; + LevelMode lm; + + LevelLand(TileIndex start_tile, bool diagonal, LevelMode lm) + :start_tile{start_tile}, diagonal{diagonal}, lm{lm} {} + LevelLand(TileIndex tile, TileIndex start_tile, bool diagonal, LevelMode lm) + :Command{tile}, start_tile{start_tile}, diagonal{diagonal}, lm{lm} {} + ~LevelLand() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class MoneyCheat: public Command { +public: + Money amount; + + MoneyCheat(Money amount) + :amount{amount} {} + ~MoneyCheat() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ChangeBankBalance: public Command { +public: + Money delta; + CompanyID company; + ExpensesType expenses_type; + + ChangeBankBalance(Money delta, CompanyID company, ExpensesType expenses_type) + :delta{delta}, company{company}, expenses_type{expenses_type} {} + ChangeBankBalance(TileIndex tile, Money delta, CompanyID company, ExpensesType expenses_type) + :Command{tile}, delta{delta}, company{company}, expenses_type{expenses_type} {} + ~ChangeBankBalance() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class IncreaseLoan: public Command { +public: + LoanCommand cmd; + Money amount; + + IncreaseLoan(LoanCommand cmd, Money amount) + :cmd{cmd}, amount{amount} {} + ~IncreaseLoan() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class DecreaseLoan: public Command { +public: + LoanCommand cmd; + Money amount; + + DecreaseLoan(LoanCommand cmd, Money amount) + :cmd{cmd}, amount{amount} {} + ~DecreaseLoan() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class Pause: public Command { +public: + PauseMode mode; + bool pause; + + Pause(PauseMode mode, bool pause) + :mode{mode}, pause{pause} {} + ~Pause() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ModifyOrder: public Command { +public: + VehicleID veh; + VehicleOrderID sel_ord; + ModifyOrderFlags mof; + uint16 data; + + ModifyOrder(VehicleID veh, VehicleOrderID sel_ord, ModifyOrderFlags mof, uint16 data) + :veh{veh}, sel_ord{sel_ord}, mof{mof}, data{data} {} + ~ModifyOrder() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SkipToOrder: public Command { +public: + VehicleID veh_id; + VehicleOrderID sel_ord; + + SkipToOrder(VehicleID veh_id, VehicleOrderID sel_ord) + :veh_id{veh_id}, sel_ord{sel_ord} {} + ~SkipToOrder() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class DeleteOrder: public Command { +public: + VehicleID veh_id; + VehicleOrderID sel_ord; + + DeleteOrder(VehicleID veh_id, VehicleOrderID sel_ord) + :veh_id{veh_id}, sel_ord{sel_ord} {} + ~DeleteOrder() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class InsertOrder: public Command { +public: + VehicleID veh; + VehicleOrderID sel_ord; + const Order &new_order; + + InsertOrder(VehicleID veh, VehicleOrderID sel_ord, const Order &new_order) + :veh{veh}, sel_ord{sel_ord}, new_order{new_order} {} + ~InsertOrder() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class OrderRefit: public Command { +public: + VehicleID veh; + VehicleOrderID order_number; + CargoID cargo; + + OrderRefit(VehicleID veh, VehicleOrderID order_number, CargoID cargo) + :veh{veh}, order_number{order_number}, cargo{cargo} {} + ~OrderRefit() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class CloneOrder: public Command { +public: + CloneOptions action; + VehicleID veh_dst; + VehicleID veh_src; + + CloneOrder(CloneOptions action, VehicleID veh_dst, VehicleID veh_src) + :action{action}, veh_dst{veh_dst}, veh_src{veh_src} {} + ~CloneOrder() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class MoveOrder: public Command { +public: + VehicleID veh; + VehicleOrderID moving_order; + VehicleOrderID target_order; + + MoveOrder(VehicleID veh, VehicleOrderID moving_order, VehicleOrderID target_order) + :veh{veh}, moving_order{moving_order}, target_order{target_order} {} + ~MoveOrder() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ClearOrderBackup: public Command { +public: + ClientID user_id; + + ClearOrderBackup(ClientID user_id) + :user_id{user_id} {} + ClearOrderBackup(TileIndex tile, ClientID user_id) + :Command{tile}, user_id{user_id} {} + ~ClearOrderBackup() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class CreateSubsidy: public Command { +public: + CargoID cid; + SourceType src_type; + SourceID src; + SourceType dst_type; + SourceID dst; + + CreateSubsidy(CargoID cid, SourceType src_type, SourceID src, SourceType dst_type, SourceID dst) + :cid{cid}, src_type{src_type}, src{src}, dst_type{dst_type}, dst{dst} {} + ~CreateSubsidy() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class ScrollViewport: public Command { +public: + ViewportScrollTarget target; + uint32 ref; + + ScrollViewport(ViewportScrollTarget target, uint32 ref) + :target{target}, ref{ref} {} + ScrollViewport(TileIndex tile, ViewportScrollTarget target, uint32 ref) + :Command{tile}, target{target}, ref{ref} {} + ~ScrollViewport() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuyShareInCompany: public Command { +public: + CompanyID target_company; + + BuyShareInCompany(CompanyID target_company) + :target_company{target_company} {} + ~BuyShareInCompany() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class SellShareInCompany: public Command { +public: + CompanyID target_company; + + SellShareInCompany(CompanyID target_company) + :target_company{target_company} {} + ~SellShareInCompany() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; +}; + +class BuyCompany: public Command { +public: + CompanyID target_company; + + BuyCompany(CompanyID target_company) + :target_company{target_company} {} + ~BuyCompany() override {} + + bool do_post(CommandCallback * callback) override; + bool do_test() override; }; } // namespace cmd diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index bda2c5ab83..fa63991908 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -217,6 +217,11 @@ struct BuildDocksToolbarWindow : Window { DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile)); TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile); + if (citymania::UseImprovedStationJoin()) { + citymania::PlaceDock(tile, tile_to); + break; + } + bool adjacent = _ctrl_pressed; auto proc = [=](bool test, StationID to_join) -> bool { if (test) { diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 5dc4339698..970beaeb05 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -375,8 +375,8 @@ struct MainWindow : Window case GHK_BORROW_ALL: citymania::cmd::IncreaseLoan(LoanCommand::Max, 0) - .WithError(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY) - .Post(); + .with_error(STR_ERROR_CAN_T_BORROW_ANY_MORE_MONEY) + .post(); break; case GHK_CHAT: // smart chat; send to team if any, otherwise to all diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 480f402b18..19ae02126d 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -170,8 +170,7 @@ void CcRoadStop(Commands cmd, const CommandCost &result, TileIndex tile, uint8 w static void PlaceRoadStop(TileIndex start_tile, TileIndex end_tile, RoadStopType stop_type, bool adjacent, RoadType rt, StringID err_msg) { if (citymania::UseImprovedStationJoin()) { - // FIXME -// citymania::PlaceRoadStop(start_tile, end_tile, stop_type, adjacent, rt, err_msg); + citymania::PlaceRoadStop(start_tile, end_tile, stop_type, adjacent, rt, err_msg); return; } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index ccf6f430ae..5a93c08a96 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2213,10 +2213,10 @@ void UpdateAirportsNoise() * @param airport_type airport type, @see airport.h * @param layout airport layout * @param station_to_join station ID to join (NEW_STATION if build new one) - * @param allow_adjacent allow airports directly adjacent to other airports. + * @param adjacent allow airports directly adjacent to other airports. * @return the cost of this operation or an error */ -CommandCost CmdBuildAirport(DoCommandFlag flags, TileIndex tile, byte airport_type, byte layout, StationID station_to_join, bool allow_adjacent) +CommandCost CmdBuildAirport(DoCommandFlag flags, TileIndex tile, byte airport_type, byte layout, StationID station_to_join, bool adjacent) { bool reuse = (station_to_join != NEW_STATION); if (!reuse) station_to_join = INVALID_STATION; @@ -2281,7 +2281,7 @@ CommandCost CmdBuildAirport(DoCommandFlag flags, TileIndex tile, byte airport_ty } Station *st = nullptr; - ret = FindJoiningStation(INVALID_STATION, station_to_join, allow_adjacent, airport_area, &st); + ret = FindJoiningStation(INVALID_STATION, station_to_join, adjacent, airport_area, &st); if (ret.Failed()) return ret; /* Distant join */ diff --git a/src/station_cmd.h b/src/station_cmd.h index 7dc23c68dc..3a284b155a 100644 --- a/src/station_cmd.h +++ b/src/station_cmd.h @@ -15,7 +15,7 @@ enum StationClassID : byte; -CommandCost CmdBuildAirport(DoCommandFlag flags, TileIndex tile, byte airport_type, byte layout, StationID station_to_join, bool allow_adjacent); +CommandCost CmdBuildAirport(DoCommandFlag flags, TileIndex tile, byte airport_type, byte layout, StationID station_to_join, bool adjacent); CommandCost CmdBuildDock(DoCommandFlag flags, TileIndex tile, StationID station_to_join, bool adjacent); CommandCost CmdBuildRailStation(DoCommandFlag flags, TileIndex tile_org, RailType rt, Axis axis, byte numtracks, byte plat_len, StationClassID spec_class, byte spec_index, StationID station_to_join, bool adjacent); CommandCost CmdRemoveFromRailStation(DoCommandFlag flags, TileIndex start, TileIndex end, bool keep_rail); diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 46c9af5986..3d46abd129 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -2170,9 +2170,9 @@ struct MainToolbarWindow : Window { case CM_CBF_BUILD_HQ: if(citymania::cmd::BuildObject(OBJECT_HQ, 0) - .WithTile(tile) - .WithError(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS) - .Post()) { + .with_tile(tile) + .with_error(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS) + .post()) { ResetObjectToPlace(); this->RaiseButtons(); } diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 5970a6fa9e..742edeb16c 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -920,10 +920,10 @@ static void DoRegularFunding(Town *t) } else if (_tick_counter - t->last_funding < TOWN_GROWTH_TICKS) return; citymania::cmd::DoTownAction(t->index, HK_FUND) - .WithTile(t->xy) - .SetAuto() - .AsCompany(_local_company) - .Post(); + .with_tile(t->xy) + .set_auto() + .as_company(_local_company) + .post(); t->last_funding = _tick_counter; } @@ -957,10 +957,10 @@ static void DoRegularAdvertising(Town *t) { t->last_advertisement = _tick_counter; citymania::cmd::DoTownAction(t->index, HK_LADVERT) - .WithTile(t->xy) - .SetAuto() - .AsCompany(_local_company) - .Post(); + .with_tile(t->xy) + .set_auto() + .as_company(_local_company) + .post(); } static void TownTickHandler(Town *t) diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 0909382c19..d9ea5e59c7 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -62,9 +62,9 @@ static void DrawExtraTownInfo (const Rect &r, uint &y, Town *town, uint line, bo bool TownExecuteAction(const Town *town, uint action){ if(!(action == HK_STATUE && HasBit(town->statues, _current_company))){ //don't built statue when there is one return citymania::cmd::DoTownAction(town->index, action) - .WithTile(town->xy) - .WithError(STR_ERROR_CAN_T_DO_THIS) - .Post(); + .with_tile(town->xy) + .with_error(STR_ERROR_CAN_T_DO_THIS) + .post(); } return false; }