42 this->num_profit_vehicle = 0;
43 this->profit_last_year = 0;
46 void ClearAutoreplace()
48 this->autoreplace_defined =
false;
49 this->autoreplace_finished =
false;
81 static inline bool IsDefaultGroupID(
GroupID index)
96 #define FOR_ALL_GROUPS_FROM(var, start) FOR_ALL_ITEMS_FROM(Group, group_index, var, start) 97 #define FOR_ALL_GROUPS(var) FOR_ALL_GROUPS_FROM(var, 0) 105 void RemoveAllGroupsForCompany(
const CompanyID company);
static void UpdateAfterLoad()
Update all caches after loading a game, changing NewGRF etc.
bool replace_protection
If set to true, the global autoreplace have no effect on the group.
GroupStatistics statistics
NOSAVE: Statistics and caches on the vehicles in the group.
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...
Types related to engines.
uint16 * num_engines
Caches the number of engines of each type the company owns.
bool GroupIsInGroup(GroupID search, GroupID group)
Test if GroupID group is a descendant of (or is) GroupID search.
Money profit_last_year
Sum of profits for all vehicles.
bool autoreplace_finished
Have all autoreplacement finished?
uint16 num_profit_vehicle
Number of vehicles considered for profit statistics;.
static GroupStatistics & GetAllGroup(const Vehicle *v)
Returns the GroupStatistic for the ALL_GROUPO of a vehicle type.
Defintion of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle...
GroupPool _group_pool
Pool of groups.
static bool IsAllGroupID(GroupID id_g)
Checks if a GroupID stands for all vehicles of a company.
Statistics and caches on the vehicles in a group.
VehicleType
Available vehicle types.
void SetTrainGroupID(Train *v, GroupID grp)
Affect the groupID of a train to new_g.
uint16 GroupID
Type for all group identifiers.
VehicleTypeByte vehicle_type
Vehicle type of the group.
static GroupStatistics & Get(CompanyID company, GroupID id_g, VehicleType type)
Returns the GroupStatistics for a specific group.
static void CountVehicle(const Vehicle *v, int delta)
Update num_vehicle when adding or removing a vehicle.
void Clear()
Clear all caches.
uint16 num_vehicle
Number of vehicles.
void UpdateTrainGroupID(Train *v)
Recalculates the groupID of a train.
Base class for all PoolItems.
Base class for all pools.
'Train' is either a loco or a wagon.
static void UpdateProfits()
Recompute the profits for all groups.
static const GroupID DEFAULT_GROUP
Ungrouped vehicles are in this group.
GroupID parent
Parent group.
uint16 EngineID
Unique identification number of an engine.
bool autoreplace_defined
Are any autoreplace rules set?
Types related to vehicles.
static void UpdateAutoreplace(CompanyID company)
Update autoreplace_defined and autoreplace_finished of all statistics of a company.
static void CountEngine(const Vehicle *v, int delta)
Update num_engines when adding/removing an engine.
Types related to companies.
OwnerByte owner
Group Owner.
void RemoveVehicleFromGroup(const Vehicle *v)
Decrease the num_vehicle variable before delete an front engine from a group.
static void VehicleReachedProfitAge(const Vehicle *v)
Add a vehicle to the profit sum of its group.
Owner
Enum for all companies/owners.
static const GroupID ALL_GROUP
All vehicles are in this group.