diff options
author | frosch <frosch@openttd.org> | 2011-10-03 17:21:41 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2011-10-03 17:21:41 +0000 |
commit | 68f969282e646b3fde7797a91beb3e38701564a6 (patch) | |
tree | 4232fd570a964de4cdd3967039034befc901e803 /src/group.h | |
parent | b78a459613320d5c45052ece08de55a574104530 (diff) | |
download | openttd-68f969282e646b3fde7797a91beb3e38701564a6.tar.xz |
(svn r22978) -Codechange: Replace IncreaseGroupNumVehicle() and DecreaseGroupNumVehicle() with GroupStatistics::CountVehicle().
Diffstat (limited to 'src/group.h')
-rw-r--r-- | src/group.h | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/src/group.h b/src/group.h index 2b6e72492..bb87760c6 100644 --- a/src/group.h +++ b/src/group.h @@ -31,6 +31,11 @@ struct GroupStatistics { void Clear(); + static GroupStatistics &Get(CompanyID company, GroupID id_g, VehicleType type); + static GroupStatistics &Get(const Vehicle *v); + + static void CountVehicle(const Vehicle *v, int delta); + static void UpdateAfterLoad(); }; @@ -81,27 +86,6 @@ static inline uint GetGroupArraySize() uint GetGroupNumEngines(CompanyID company, GroupID id_g, EngineID id_e); -/** - * Increase the number of vehicles by one in a group. - * @param id_g Group id. - */ -static inline void IncreaseGroupNumVehicle(GroupID id_g) -{ - Group *g = Group::GetIfValid(id_g); - if (g != NULL) g->statistics.num_vehicle++; -} - -/** - * Decrease the number of vehicles by one in a group. - * @param id_g Group id. - */ -static inline void DecreaseGroupNumVehicle(GroupID id_g) -{ - Group *g = Group::GetIfValid(id_g); - if (g != NULL) g->statistics.num_vehicle--; -} - - void SetTrainGroupID(Train *v, GroupID grp); void UpdateTrainGroupID(Train *v); void RemoveVehicleFromGroup(const Vehicle *v); |