(svn r22978) -Codechange: Replace IncreaseGroupNumVehicle() and DecreaseGroupNumVehicle() with GroupStatistics::CountVehicle().

This commit is contained in:
frosch
2011-10-03 17:21:41 +00:00
parent b78a459613
commit 68f969282e
4 changed files with 59 additions and 30 deletions

View File

@@ -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);