|
OpenTTD Source
14.0-beta3
|
#include "group_type.h"#include "core/pool_type.hpp"#include "company_type.h"#include "vehicle_type.h"#include "engine_type.h"#include "livery.h"Go to the source code of this file.
Data Structures | |
| struct | GroupStatistics |
| Statistics and caches on the vehicles in a group. More... | |
| struct | Group |
| Group data. More... | |
Typedefs | |
| typedef Pool< Group, GroupID, 16, 64000 > | GroupPool |
Enumerations | |
| enum | GroupFlags : uint8_t { GF_REPLACE_PROTECTION, GF_REPLACE_WAGON_REMOVAL, GF_END } |
Functions | |
| bool | IsDefaultGroupID (GroupID index) |
| bool | IsAllGroupID (GroupID id_g) |
| Checks if a GroupID stands for all vehicles of a company. More... | |
| uint | GetGroupNumEngines (CompanyID company, GroupID id_g, EngineID id_e) |
| Get the number of engines with EngineID id_e in the group with GroupID id_g and its sub-groups. More... | |
| uint | GetGroupNumVehicle (CompanyID company, GroupID id_g, VehicleType type) |
| Get the number of vehicles in the group with GroupID id_g and its sub-groups. More... | |
| uint | GetGroupNumVehicleMinAge (CompanyID company, GroupID id_g, VehicleType type) |
| Get the number of vehicles above profit minimum age in the group with GroupID id_g and its sub-groups. More... | |
| Money | GetGroupProfitLastYearMinAge (CompanyID company, GroupID id_g, VehicleType type) |
| Get last year's profit of vehicles above minimum age for the group with GroupID id_g and its sub-groups. More... | |
| void | SetTrainGroupID (Train *v, GroupID grp) |
| Affect the groupID of a train to new_g. More... | |
| void | UpdateTrainGroupID (Train *v) |
| Recalculates the groupID of a train. More... | |
| void | RemoveAllGroupsForCompany (const CompanyID company) |
| bool | GroupIsInGroup (GroupID search, GroupID group) |
| Test if GroupID group is a descendant of (or is) GroupID search. More... | |
| void | UpdateCompanyGroupLiveries (const Company *c) |
| Update group liveries for a company. More... | |
Variables | |
| GroupPool | _group_pool |
| Pool of groups. | |
Base class for groups and group functions.
Definition in file group.h.
| enum GroupFlags : uint8_t |
Get the number of engines with EngineID id_e in the group with GroupID id_g and its sub-groups.
| company | The company the group belongs to |
| id_g | The GroupID of the group used |
| id_e | The EngineID of the engine to count |
Definition at line 797 of file group_cmd.cpp.
References GroupStatistics::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::Get(), GroupStatistics::GetNumEngines(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::Iterate(), Group::parent, and Engine::type.
Referenced by ReplaceVehicleWindow::GenerateReplaceVehList(), and InvalidateAutoreplaceWindow().
| uint GetGroupNumVehicle | ( | CompanyID | company, |
| GroupID | id_g, | ||
| VehicleType | type | ||
| ) |
Get the number of vehicles in the group with GroupID id_g and its sub-groups.
| company | The company the group belongs to |
| id_g | The GroupID of the group used |
| type | The vehicle type of the group |
Definition at line 815 of file group_cmd.cpp.
References GroupStatistics::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::Iterate(), GroupStatistics::num_vehicle, and Group::parent.
| uint GetGroupNumVehicleMinAge | ( | CompanyID | company, |
| GroupID | id_g, | ||
| VehicleType | type | ||
| ) |
Get the number of vehicles above profit minimum age in the group with GroupID id_g and its sub-groups.
| company | The company the group belongs to |
| id_g | The GroupID of the group used |
| type | The vehicle type of the group |
Definition at line 832 of file group_cmd.cpp.
References GroupStatistics::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::Iterate(), GroupStatistics::num_vehicle_min_age, and Group::parent.
| Money GetGroupProfitLastYearMinAge | ( | CompanyID | company, |
| GroupID | id_g, | ||
| VehicleType | type | ||
| ) |
Get last year's profit of vehicles above minimum age for the group with GroupID id_g and its sub-groups.
| company | The company the group belongs to |
| id_g | The GroupID of the group used |
| type | The vehicle type of the group |
Definition at line 849 of file group_cmd.cpp.
References GroupStatistics::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::Iterate(), Group::parent, and GroupStatistics::profit_last_year_min_age.
Test if GroupID group is a descendant of (or is) GroupID search.
| search | The GroupID to search in |
| group | The GroupID to search for |
Definition at line 872 of file group_cmd.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::Get(), INVALID_GROUP, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::IsValidID().
Referenced by CmdAlterGroup(), and GetEngineReplacement().
|
inline |
Checks if a GroupID stands for all vehicles of a company.
| id_g | The GroupID to check |
Definition at line 99 of file group.h.
References ALL_GROUP.
Referenced by CmdSetAutoReplace(), VehicleGroupWindow::DirtyHighlightedGroupWidget(), and VehicleGroupWindow::OnInvalidateData().
Affect the groupID of a train to new_g.
| v | First vehicle of the chain. |
| new_g | index of array group |
Definition at line 743 of file group_cmd.cpp.
| void UpdateCompanyGroupLiveries | ( | const Company * | c | ) |
Update group liveries for a company.
This is called when the LS_DEFAULT scheme is changed, to update groups with colours set to default.
| c | Company to update. |
Definition at line 311 of file group_cmd.cpp.
References Livery::colour1, HasBit(), Livery::in_use, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, INVALID_GROUP, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_group_pool >::Iterate(), Group::livery, Group::owner, and Group::parent.
| void UpdateTrainGroupID | ( | Train * | v | ) |
Recalculates the groupID of a train.
Should be called each time a vehicle is added to/removed from the chain,.
| v | First vehicle of the chain. |
Definition at line 771 of file group_cmd.cpp.
References DEFAULT_GROUP, Vehicle::group_id, GroundVehicle< T, Type >::IsFreeWagon(), Vehicle::IsFrontEngine(), SpecializedVehicle< T, Type >::Next(), and UpdateNumEngineGroup().
Referenced by NormaliseTrainHead().