OpenTTD Source: src/group_cmd.h Source File

OpenTTD Source 14.0-beta1

group_cmd.h
Go to the documentation of this file.
1 /*
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/>.
6 */
7
10 #ifndef GROUP_CMD_H
11 #define GROUP_CMD_H
12
13 #include "command_type.h"
14 #include "group_type.h"
15 #include "vehicle_type.h"
16 #include "vehiclelist.h"
17 #include "vehiclelist_cmd.h"
18
19 enum Colours : byte;
20 enum GroupFlags : uint8_t;
21
23 enum class AlterGroupMode : byte {
24 Rename,
25 SetParent,
26 };
27
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);
36
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)
45
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 &);
48
49 #endif /* GROUP_CMD_H */
CmdAlterGroup
CommandCost CmdAlterGroup(DoCommandFlag flags, AlterGroupMode mode, GroupID group_id, GroupID parent_id, const std::string &text)
Alter a group.
Definition: group_cmd.cpp:432
GroupFlags
GroupFlags
Definition: group.h:65
AlterGroupMode
AlterGroupMode
Action for CmdAlterGroup.
Definition: group_cmd.h:23
VehicleListIdentifier
The information about a vehicle list.
Definition: vehiclelist.h:28
vehiclelist.h
CMD_ADD_SHARED_VEHICLE_GROUP
@ CMD_ADD_SHARED_VEHICLE_GROUP
add all other shared vehicles to a group which are missing
Definition: command_type.h:341
DoCommandFlag
DoCommandFlag
List of flags for a command.
Definition: command_type.h:369
CMD_ADD_VEHICLE_GROUP
@ CMD_ADD_VEHICLE_GROUP
add a vehicle to a group
Definition: command_type.h:340
AlterGroupMode::Rename
@ Rename
Change group name.
CommandCost
Common return value for all commands.
Definition: command_type.h:23
CMDT_OTHER_MANAGEMENT
@ CMDT_OTHER_MANAGEMENT
Renaming stuff, changing company colours, placing signs, etc.
Definition: command_type.h:414
CMD_REMOVE_ALL_VEHICLES_GROUP
@ CMD_REMOVE_ALL_VEHICLES_GROUP
remove all vehicles from a group
Definition: command_type.h:342
CmdCreateGroup
std::tuple< CommandCost, GroupID > CmdCreateGroup(DoCommandFlag flags, VehicleType vt, GroupID parent_group)
Create a new vehicle group.
Definition: group_cmd.cpp:336
CcAddVehicleNewGroup
void CcAddVehicleNewGroup(Commands cmd, const CommandCost &result, GroupID new_group, GroupID, VehicleID veh_id, bool, const VehicleListIdentifier &)
Open rename window after adding a vehicle to a new group via drag and drop.
Definition: group_gui.cpp:1189
CMDT_ROUTE_MANAGEMENT
@ CMDT_ROUTE_MANAGEMENT
Modifications to route management (orders, groups, etc).
Definition: command_type.h:413
CmdSetGroupFlag
CommandCost CmdSetGroupFlag(DoCommandFlag flags, GroupID group_id, GroupFlags flag, bool value, bool recursive)
(Un)set group flag from a group
Definition: group_cmd.cpp:720
CmdSetGroupLivery
CommandCost CmdSetGroupLivery(DoCommandFlag flags, GroupID group_id, bool primary, Colours colour)
Set the livery for a vehicle group.
Definition: group_cmd.cpp:665
vehiclelist_cmd.h
VehicleID
uint32_t VehicleID
The type all our vehicle IDs have.
Definition: vehicle_type.h:16
CMD_ALTER_GROUP
@ CMD_ALTER_GROUP
alter a group
Definition: command_type.h:339
VehicleType
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
command_type.h
CmdDeleteGroup
CommandCost CmdDeleteGroup(DoCommandFlag flags, GroupID group_id)
Add all vehicles in the given group to the default group and then deletes the group.
Definition: group_cmd.cpp:381
vehicle_type.h
CMD_CREATE_GROUP
@ CMD_CREATE_GROUP
create a new group
Definition: command_type.h:337
CMD_SET_GROUP_LIVERY
@ CMD_SET_GROUP_LIVERY
set the livery for a group
Definition: command_type.h:344
CMD_SET_GROUP_FLAG
@ CMD_SET_GROUP_FLAG
set/clear a flag for a group
Definition: command_type.h:343
CmdAddSharedVehicleGroup
CommandCost CmdAddSharedVehicleGroup(DoCommandFlag flags, GroupID id_g, VehicleType type)
Add all shared vehicles of all vehicles from a group.
Definition: group_cmd.cpp:604
CmdAddVehicleGroup
std::tuple< CommandCost, GroupID > CmdAddVehicleGroup(DoCommandFlag flags, GroupID group_id, VehicleID veh_id, bool add_shared, const VehicleListIdentifier &vli)
Add a vehicle to a group.
Definition: group_cmd.cpp:535
GroupID
uint16_t GroupID
Type for all group identifiers.
Definition: group_type.h:13
AlterGroupMode::SetParent
@ SetParent
Change group parent.
CMD_DELETE_GROUP
@ CMD_DELETE_GROUP
delete a group
Definition: command_type.h:338
CmdRemoveAllVehiclesGroup
CommandCost CmdRemoveAllVehiclesGroup(DoCommandFlag flags, GroupID group_id)
Remove all vehicles from a group.
Definition: group_cmd.cpp:635
Commands
Commands
List of commands.
Definition: command_type.h:187
group_type.h
CcCreateGroup
void CcCreateGroup(Commands cmd, const CommandCost &result, GroupID new_group, VehicleType vt, GroupID parent_group)
Opens a 'Rename group' window for newly created group.
Definition: group_gui.cpp:1176