* Get the number of vehicles in 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 The number of vehicles in the group */
| 838 | * @return The number of vehicles in the group |
| 839 | */ |
| 840 | uint GetGroupNumVehicle(CompanyID company, GroupID id_g, VehicleType type) |
| 841 | { |
| 842 | uint count = 0; |
| 843 | |
| 844 | if (const Group *g = Group::GetIfValid(id_g); g != nullptr) { |
| 845 | for (const GroupID &childgroup : g->children) { |
| 846 | count += GetGroupNumVehicle(company, childgroup, type); |
| 847 | } |
| 848 | } |
| 849 | |
| 850 | return count + GroupStatistics::Get(company, id_g, type).num_vehicle; |
| 851 | } |
| 852 | |
| 853 | /** |
| 854 | * Get the number of vehicles above profit minimum age in the group with GroupID |
no outgoing calls
no test coverage detected