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

Function GetGroupProfitLastYearMinAge

src/group_cmd.cpp:882–893  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

880 * @return Last year's profit of vehicles above minimum age for the group
881 */
882Money 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
895void RemoveAllGroupsForCompany(const CompanyID company)
896{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected