2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file group_cmd.h Command definitions related to engine groups. */
13 #include "command_type.h"
14 #include "group_type.h"
15 #include "vehicle_type.h"
16 #include "vehiclelist.h"
17 #include "vehiclelist_cmd.h"
19 enum Colours
: uint8_t;
20 enum GroupFlags
: uint8_t;
22 /** Action for \c CmdAlterGroup. */
23 enum class AlterGroupMode
: uint8_t {
24 Rename
, ///< Change group name.
25 SetParent
, ///< Change group parent.
28 std::tuple
<CommandCost
, GroupID
> CmdCreateGroup(DoCommandFlag flags
, VehicleType vt
, GroupID parent_group
);
29 CommandCost
CmdAlterGroup(DoCommandFlag flags
, AlterGroupMode mode
, GroupID group_id
, GroupID parent_id
, const std::string
&text
);
30 CommandCost
CmdDeleteGroup(DoCommandFlag flags
, GroupID group_id
);
31 std::tuple
<CommandCost
, GroupID
> CmdAddVehicleGroup(DoCommandFlag flags
, GroupID group_id
, VehicleID veh_id
, bool add_shared
, const VehicleListIdentifier
&vli
);
32 CommandCost
CmdAddSharedVehicleGroup(DoCommandFlag flags
, GroupID id_g
, VehicleType type
);
33 CommandCost
CmdRemoveAllVehiclesGroup(DoCommandFlag flags
, GroupID group_id
);
34 CommandCost
CmdSetGroupFlag(DoCommandFlag flags
, GroupID group_id
, GroupFlags flag
, bool value
, bool recursive
);
35 CommandCost
CmdSetGroupLivery(DoCommandFlag flags
, GroupID group_id
, bool primary
, Colours colour
);
37 DEF_CMD_TRAIT(CMD_CREATE_GROUP
, CmdCreateGroup
, 0, CMDT_ROUTE_MANAGEMENT
)
38 DEF_CMD_TRAIT(CMD_DELETE_GROUP
, CmdDeleteGroup
, 0, CMDT_ROUTE_MANAGEMENT
)
39 DEF_CMD_TRAIT(CMD_ALTER_GROUP
, CmdAlterGroup
, 0, CMDT_OTHER_MANAGEMENT
)
40 DEF_CMD_TRAIT(CMD_ADD_VEHICLE_GROUP
, CmdAddVehicleGroup
, 0, CMDT_ROUTE_MANAGEMENT
)
41 DEF_CMD_TRAIT(CMD_ADD_SHARED_VEHICLE_GROUP
, CmdAddSharedVehicleGroup
, 0, CMDT_ROUTE_MANAGEMENT
)
42 DEF_CMD_TRAIT(CMD_REMOVE_ALL_VEHICLES_GROUP
, CmdRemoveAllVehiclesGroup
, 0, CMDT_ROUTE_MANAGEMENT
)
43 DEF_CMD_TRAIT(CMD_SET_GROUP_FLAG
, CmdSetGroupFlag
, 0, CMDT_ROUTE_MANAGEMENT
)
44 DEF_CMD_TRAIT(CMD_SET_GROUP_LIVERY
, CmdSetGroupLivery
, 0, CMDT_ROUTE_MANAGEMENT
)
46 void CcCreateGroup(Commands cmd
, const CommandCost
&result
, GroupID new_group
, VehicleType vt
, GroupID parent_group
);
47 void CcAddVehicleNewGroup(Commands cmd
, const CommandCost
&result
, GroupID new_group
, GroupID
, VehicleID veh_id
, bool, const VehicleListIdentifier
&);
49 #endif /* GROUP_CMD_H */