* Get last year's profit of vehicles above minimum age * for the group with GroupID id_g and its sub-groups. * @param company The company the group belongs to * @param id_g The GroupID of the group used * @param type The vehicle type of the group * @return Last year's profit of vehicles above minimum age for the group */
| 880 | * @return Last year's profit of vehicles above minimum age for the group |
| 881 | */ |
| 882 | Money GetGroupProfitLastYearMinAge(CompanyID company, GroupID id_g, VehicleType type) |
| 883 | { |
| 884 | Money sum = 0; |
| 885 | |
| 886 | if (const Group *g = Group::GetIfValid(id_g); g != nullptr) { |
| 887 | for (const GroupID &childgroup : g->children) { |
| 888 | sum += GetGroupProfitLastYearMinAge(company, childgroup, type); |
| 889 | } |
| 890 | } |
| 891 | |
| 892 | return sum + GroupStatistics::Get(company, id_g, type).profit_last_year_min_age; |
| 893 | } |
| 894 | |
| 895 | void RemoveAllGroupsForCompany(const CompanyID company) |
| 896 | { |
no outgoing calls
no test coverage detected