OpenTTD Source: src/group_cmd.h Source File

OpenTTD Source 15.0-RC2

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 <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
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
19enum Colours : uint8_t;
20enum class GroupFlag : uint8_t;
21
23 enum class AlterGroupMode : uint8_t {
24 Rename,
25 SetParent,
26};
27
28std::tuple<CommandCost, GroupID> CmdCreateGroup(DoCommandFlags flags, VehicleType vt, GroupID parent_group);
29 CommandCost CmdAlterGroup(DoCommandFlags flags, AlterGroupMode mode, GroupID group_id, GroupID parent_id, const std::string &text);
30 CommandCost CmdDeleteGroup(DoCommandFlags flags, GroupID group_id);
31std::tuple<CommandCost, GroupID> CmdAddVehicleGroup(DoCommandFlags flags, GroupID group_id, VehicleID veh_id, bool add_shared, const VehicleListIdentifier &vli);
32 CommandCost CmdAddSharedVehicleGroup(DoCommandFlags flags, GroupID id_g, VehicleType type);
33 CommandCost CmdRemoveAllVehiclesGroup(DoCommandFlags flags, GroupID group_id);
34 CommandCost CmdSetGroupFlag(DoCommandFlags flags, GroupID group_id, GroupFlag flag, bool value, bool recursive);
35 CommandCost CmdSetGroupLivery(DoCommandFlags flags, GroupID group_id, bool primary, Colours colour);
36
37DEF_CMD_TRAIT(CMD_CREATE_GROUP, CmdCreateGroup, {}, CommandType::RouteManagement)
38DEF_CMD_TRAIT(CMD_DELETE_GROUP, CmdDeleteGroup, {}, CommandType::RouteManagement)
39DEF_CMD_TRAIT(CMD_ALTER_GROUP, CmdAlterGroup, {}, CommandType::OtherManagement)
40DEF_CMD_TRAIT(CMD_ADD_VEHICLE_GROUP, CmdAddVehicleGroup, {}, CommandType::RouteManagement)
41DEF_CMD_TRAIT(CMD_ADD_SHARED_VEHICLE_GROUP, CmdAddSharedVehicleGroup, {}, CommandType::RouteManagement)
42DEF_CMD_TRAIT(CMD_REMOVE_ALL_VEHICLES_GROUP, CmdRemoveAllVehiclesGroup, {}, CommandType::RouteManagement)
43DEF_CMD_TRAIT(CMD_SET_GROUP_FLAG, CmdSetGroupFlag, {}, CommandType::RouteManagement)
44DEF_CMD_TRAIT(CMD_SET_GROUP_LIVERY, CmdSetGroupLivery, {}, CommandType::RouteManagement)
45
46void CcCreateGroup(Commands cmd, const CommandCost &result, GroupID new_group, VehicleType vt, GroupID parent_group);
47void CcAddVehicleNewGroup(Commands cmd, const CommandCost &result, GroupID new_group, GroupID, VehicleID veh_id, bool, const VehicleListIdentifier &);
48
49#endif /* GROUP_CMD_H */
CommandCost
Common return value for all commands.
Definition command_type.h:24
EnumBitSet
Enum-as-bit-set wrapper.
Definition enum_type.hpp:177
command_type.h
Types related to commands.
CommandType::RouteManagement
@ RouteManagement
Modifications to route management (orders, groups, etc).
CommandType::OtherManagement
@ OtherManagement
Renaming stuff, changing company colours, placing signs, etc.
Commands
Commands
List of commands.
Definition command_type.h:196
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:358
CMD_ADD_VEHICLE_GROUP
@ CMD_ADD_VEHICLE_GROUP
add a vehicle to a group
Definition command_type.h:357
CMD_ALTER_GROUP
@ CMD_ALTER_GROUP
alter a group
Definition command_type.h:356
CMD_SET_GROUP_FLAG
@ CMD_SET_GROUP_FLAG
set/clear a flag for a group
Definition command_type.h:360
CMD_SET_GROUP_LIVERY
@ CMD_SET_GROUP_LIVERY
set the livery for a group
Definition command_type.h:361
CMD_CREATE_GROUP
@ CMD_CREATE_GROUP
create a new group
Definition command_type.h:354
CMD_REMOVE_ALL_VEHICLES_GROUP
@ CMD_REMOVE_ALL_VEHICLES_GROUP
remove all vehicles from a group
Definition command_type.h:359
CMD_DELETE_GROUP
@ CMD_DELETE_GROUP
delete a group
Definition command_type.h:355
GroupFlag
GroupFlag
Definition group.h:66
CmdAddSharedVehicleGroup
CommandCost CmdAddSharedVehicleGroup(DoCommandFlags flags, GroupID id_g, VehicleType type)
Add all shared vehicles of all vehicles from a group.
Definition group_cmd.cpp:616
CmdSetGroupFlag
CommandCost CmdSetGroupFlag(DoCommandFlags flags, GroupID group_id, GroupFlag flag, bool value, bool recursive)
(Un)set group flag from a group
Definition group_cmd.cpp:732
CmdCreateGroup
std::tuple< CommandCost, GroupID > CmdCreateGroup(DoCommandFlags flags, VehicleType vt, GroupID parent_group)
Create a new vehicle group.
Definition group_cmd.cpp:339
AlterGroupMode
AlterGroupMode
Action for CmdAlterGroup.
Definition group_cmd.h:23
AlterGroupMode::Rename
@ Rename
Change group name.
AlterGroupMode::SetParent
@ SetParent
Change group parent.
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:1282
CmdAlterGroup
CommandCost CmdAlterGroup(DoCommandFlags flags, AlterGroupMode mode, GroupID group_id, GroupID parent_id, const std::string &text)
Alter a group.
Definition group_cmd.cpp:439
CmdSetGroupLivery
CommandCost CmdSetGroupLivery(DoCommandFlags flags, GroupID group_id, bool primary, Colours colour)
Set the livery for a vehicle group.
Definition group_cmd.cpp:677
CmdRemoveAllVehiclesGroup
CommandCost CmdRemoveAllVehiclesGroup(DoCommandFlags flags, GroupID group_id)
Remove all vehicles from a group.
Definition group_cmd.cpp:647
CmdDeleteGroup
CommandCost CmdDeleteGroup(DoCommandFlags flags, GroupID group_id)
Add all vehicles in the given group to the default group and then deletes the group.
Definition group_cmd.cpp:384
CmdAddVehicleGroup
std::tuple< CommandCost, GroupID > CmdAddVehicleGroup(DoCommandFlags flags, GroupID group_id, VehicleID veh_id, bool add_shared, const VehicleListIdentifier &vli)
Add a vehicle to a group.
Definition group_cmd.cpp:551
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:1295
group_type.h
Types of a group.
PoolID< uint16_t, struct GroupIDTag, 64000, 0xFFFF >
VehicleListIdentifier
The information about a vehicle list.
Definition vehiclelist.h:32
vehicle_type.h
Types related to vehicles.
VehicleType
VehicleType
Available vehicle types.
Definition vehicle_type.h:22
vehiclelist.h
Functions and type for generating vehicle lists.
vehiclelist_cmd.h
Functions and type for serializing vehicle lists.