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

Function GetGroupNumVehicle

src/group_cmd.cpp:840–851  ·  view source on GitHub ↗

* 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 */

Source from the content-addressed store, hash-verified

838 * @return The number of vehicles in the group
839 */
840uint 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

Callers 4

ComputeGroupInfoSizeMethod · 0.85
DrawGroupInfoMethod · 0.85
GetWidgetStringMethod · 0.85
GetNumVehiclesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected