|
OpenTTD Source 20251116-master-g21329071df
|
Command definitions related to engine groups. More...
#include "command_type.h"#include "group_type.h"#include "vehicle_type.h"#include "vehiclelist.h"#include "vehiclelist_cmd.h"Go to the source code of this file.
Enumerations | |
| enum class | AlterGroupMode : uint8_t { Rename , SetParent } |
Action for CmdAlterGroup. More... | |
Functions | |
| std::tuple< CommandCost, GroupID > | CmdCreateGroup (DoCommandFlags flags, VehicleType vt, GroupID parent_group) |
| Create a new vehicle group. | |
| CommandCost | CmdAlterGroup (DoCommandFlags flags, AlterGroupMode mode, GroupID group_id, GroupID parent_id, const std::string &text) |
| Alter a group. | |
| CommandCost | CmdDeleteGroup (DoCommandFlags flags, GroupID group_id) |
| Add all vehicles in the given group to the default group and then deletes the group. | |
| 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. | |
| CommandCost | CmdAddSharedVehicleGroup (DoCommandFlags flags, GroupID id_g, VehicleType type) |
| Add all shared vehicles of all vehicles from a group. | |
| CommandCost | CmdRemoveAllVehiclesGroup (DoCommandFlags flags, GroupID group_id) |
| Remove all vehicles from a group. | |
| CommandCost | CmdSetGroupFlag (DoCommandFlags flags, GroupID group_id, GroupFlag flag, bool value, bool recursive) |
| (Un)set group flag from a group | |
| CommandCost | CmdSetGroupLivery (DoCommandFlags flags, GroupID group_id, bool primary, Colours colour) |
| Set the livery for a vehicle group. | |
| void | CcCreateGroup (Commands cmd, const CommandCost &result, GroupID new_group, VehicleType vt, GroupID parent_group) |
| Opens a 'Rename group' window for newly created group. | |
| 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. | |
Command definitions related to engine groups.
Definition in file group_cmd.h.
|
strong |
Action for CmdAlterGroup.
| Enumerator | |
|---|---|
| Rename | Change group name. |
| SetParent | Change group parent. |
Definition at line 23 of file group_cmd.h.
| 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.
| result | Did command succeed? |
| new_group | ID of the created group. |
Definition at line 1257 of file group_gui.cpp.
References CcCreateGroup(), CommandCost::Failed(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::Get(), and Group::vehicle_type.
Referenced by VehicleGroupWindow::OnDropdownSelect(), and VehicleListWindow::OnDropdownSelect().
| void CcCreateGroup | ( | Commands | cmd, |
| const CommandCost & | result, | ||
| GroupID | new_group, | ||
| VehicleType | vt, | ||
| GroupID | parent_group | ||
| ) |
Opens a 'Rename group' window for newly created group.
| result | Did command succeed? |
| new_group | ID of the created group. |
| vt | Vehicle type. |
Definition at line 1244 of file group_gui.cpp.
References CcCreateGroup(), CommandCost::Failed(), and VEH_AIRCRAFT.
| CommandCost CmdAddSharedVehicleGroup | ( | DoCommandFlags | flags, |
| GroupID | id_g, | ||
| VehicleType | type | ||
| ) |
Add all shared vehicles of all vehicles from a group.
| flags | type of operation |
| id_g | index of group |
| type | type of vehicles |
Definition at line 616 of file group_cmd.cpp.
References _current_company, CMD_ERROR, Execute, Vehicle::FirstShared(), GetWindowClassForVehicleType(), InvalidateWindowData(), IsCompanyBuildableVehicleType(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::IsValidID(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::Iterate(), Vehicle::NextShared(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), and VL_GROUP_LIST.
| 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.
| flags | type of operation |
| group_id | index of group |
| veh_id | vehicle to add to a group |
| add_shared | Add shared vehicles as well. |
Definition at line 551 of file group_cmd.cpp.
References _current_company, AddVehicleToGroup(), CMD_ERROR, CmdCreateGroup(), Execute, Vehicle::FirstShared(), GenerateVehicleSortList(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::GetIfValid(), GetWindowClassForVehicleType(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::IsValidID(), NEW_GROUP, Group::owner, SetWindowDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Vehicle::tile, GroupStatistics::UpdateAutoreplace(), Group::vehicle_type, VL_GROUP_LIST, WC_REPLACE_VEHICLE, and WC_VEHICLE_DEPOT.
| CommandCost CmdAlterGroup | ( | DoCommandFlags | flags, |
| AlterGroupMode | mode, | ||
| GroupID | group_id, | ||
| GroupID | parent_id, | ||
| const std::string & | text | ||
| ) |
Alter a group.
| flags | type of operation |
| mode | Operation to perform. |
| group_id | GroupID |
| parent_id | parent group index |
| text | the new name or an empty string when resetting to the default |
Definition at line 439 of file group_cmd.cpp.
References _current_company, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::All(), CMD_ERROR, Livery::colour1, Livery::colour2, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::GetIfValid(), GetWindowClassForVehicleType(), GroupIsInGroup(), Livery::in_use, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, InvalidateWindowClassesData(), InvalidateWindowData(), Group::livery, MarkWholeScreenDirty(), MAX_LENGTH_GROUP_NAME_CHARS, Group::name, Group::owner, Group::parent, Livery::Primary, PropagateChildLivery(), Rename, Livery::Secondary, SetParent, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), VehicleListIdentifier::ToWindowNumber(), GroupStatistics::UpdateAutoreplace(), Utf8StringLength(), Group::vehicle_type, VL_GROUP_LIST, WC_COMPANY_COLOUR, WC_REPLACE_VEHICLE, WC_VEHICLE_DETAILS, and WC_VEHICLE_VIEW.
| std::tuple< CommandCost, GroupID > CmdCreateGroup | ( | DoCommandFlags | flags, |
| VehicleType | vt, | ||
| GroupID | parent_group | ||
| ) |
Create a new vehicle group.
| flags | type of operation |
| vt | vehicle type |
| parent_group | parent groupid |
Definition at line 339 of file group_cmd.cpp.
References _current_company, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::CanAllocateItem(), Group::children, CMD_ERROR, Livery::colour1, Livery::colour2, Execute, Group::flags, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::GetIfValid(), GetWindowClassForVehicleType(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, InvalidateWindowData(), IsCompanyBuildableVehicleType(), Group::livery, FreeUnitIDGenerator::NextID(), Group::number, Group::owner, Group::parent, CompanySettings::renew_keep_length, ReplaceWagonRemoval, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), CompanyProperties::settings, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), FreeUnitIDGenerator::UseID(), Group::vehicle_type, VL_GROUP_LIST, and WC_COMPANY_COLOUR.
Referenced by CmdAddVehicleGroup().
| CommandCost CmdDeleteGroup | ( | DoCommandFlags | flags, |
| GroupID | group_id | ||
| ) |
Add all vehicles in the given group to the default group and then deletes the group.
| flags | type of operation |
| group_id | index of group |
Definition at line 384 of file group_cmd.cpp.
References _current_company, Group::children, OrderBackup::ClearGroup(), CloseWindowById(), CMD_ERROR, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::GetIfValid(), GetWindowClassForVehicleType(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem< Tpool >::index, InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_enginerenew_pool >::Iterate(), Group::number, Group::owner, Group::parent, FreeUnitIDGenerator::ReleaseID(), RemoveEngineReplacementForCompany(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), Group::vehicle_type, VL_GROUP_LIST, WC_COMPANY_COLOUR, and WC_REPLACE_VEHICLE.
| CommandCost CmdRemoveAllVehiclesGroup | ( | DoCommandFlags | flags, |
| GroupID | group_id | ||
| ) |
Remove all vehicles from a group.
| flags | type of operation |
| group_id | index of group |
Definition at line 647 of file group_cmd.cpp.
References _current_company, CMD_ERROR, DEFAULT_GROUP, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::GetIfValid(), GetWindowClassForVehicleType(), InvalidateWindowData(), Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_vehicle_pool >::Iterate(), Group::owner, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), VehicleListIdentifier::ToWindowNumber(), Group::vehicle_type, and VL_GROUP_LIST.
| CommandCost CmdSetGroupFlag | ( | DoCommandFlags | flags, |
| GroupID | group_id, | ||
| GroupFlag | flag, | ||
| bool | value, | ||
| bool | recursive | ||
| ) |
(Un)set group flag from a group
| flags | type of operation |
| group_id | index of group array |
| flag | flag to set, by value not bit. |
| value | value to set the flag to. |
| recursive | to apply to sub-groups. |
Definition at line 732 of file group_cmd.cpp.
References _current_company, CMD_ERROR, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::GetIfValid(), GetWindowClassForVehicleType(), InvalidateWindowData(), Group::owner, ReplaceProtection, ReplaceWagonRemoval, SetGroupFlag(), SetWindowDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), VehicleListIdentifier::ToWindowNumber(), Group::vehicle_type, VL_GROUP_LIST, and WC_REPLACE_VEHICLE.
| CommandCost CmdSetGroupLivery | ( | DoCommandFlags | flags, |
| GroupID | group_id, | ||
| bool | primary, | ||
| Colours | colour | ||
| ) |
Set the livery for a vehicle group.
| flags | Command flags. |
| group_id | Group ID. |
| primary | Set primary instead of secondary colour |
| colour | Colour. |
Definition at line 677 of file group_cmd.cpp.
References _current_company, CMD_ERROR, Livery::colour1, Livery::colour2, Execute, Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_group_pool >::GetIfValid(), Livery::in_use, Group::livery, MarkWholeScreenDirty(), Group::owner, Livery::Primary, PropagateChildLivery(), Livery::Secondary, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Set(), and BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test().