diff --git a/src/group.h b/src/group.h --- a/src/group.h +++ b/src/group.h @@ -24,15 +24,12 @@ extern GroupPool _group_pool; ///< Pool struct GroupStatistics { Money profit_last_year; ///< Sum of profits for all vehicles. Money profit_last_year_min_age; ///< Sum of profits for vehicles considered for profit statistics. - uint16_t *num_engines; ///< Caches the number of engines of each type the company owns. + std::map num_engines; ///< Caches the number of engines of each type the company owns. uint16_t num_vehicle; ///< Number of vehicles. uint16_t num_vehicle_min_age; ///< Number of vehicles considered for profit statistics; bool autoreplace_defined; ///< Are any autoreplace rules set? bool autoreplace_finished; ///< Have all autoreplacement finished? - GroupStatistics(); - ~GroupStatistics(); - void Clear(); void ClearProfits() @@ -49,6 +46,8 @@ struct GroupStatistics { this->autoreplace_finished = false; } + uint16_t GetNumEngines(EngineID engine) const; + static GroupStatistics &Get(CompanyID company, GroupID id_g, VehicleType type); static GroupStatistics &Get(const Vehicle *v); static GroupStatistics &GetAllGroup(const Vehicle *v);