MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetGroupNumVehicleMinAge

Function GetGroupNumVehicleMinAge

src/group_cmd.cpp:861–872  ·  view source on GitHub ↗

* Get the number of vehicles above profit minimum age 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 above profit minimum age in the group */

Source from the content-addressed store, hash-verified

859 * @return The number of vehicles above profit minimum age in the group
860 */
861uint GetGroupNumVehicleMinAge(CompanyID company, GroupID id_g, VehicleType type)
862{
863 uint count = 0;
864
865 if (const Group *g = Group::GetIfValid(id_g); g != nullptr) {
866 for (const GroupID &childgroup : g->children) {
867 count += GetGroupNumVehicleMinAge(company, childgroup, type);
868 }
869 }
870
871 return count + GroupStatistics::Get(company, id_g, type).num_vehicle_min_age;
872}
873
874/**
875 * Get last year's profit of vehicles above minimum age

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected