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

Function AirportMaintenanceCost

src/station.cpp:713–724  ·  view source on GitHub ↗

* Calculates the maintenance cost of all airports of a company. * @param owner Company. * @return Total cost. */

Source from the content-addressed store, hash-verified

711 * @return Total cost.
712 */
713Money AirportMaintenanceCost(Owner owner)
714{
715 Money total_cost = 0;
716
717 for (const Station *st : Station::Iterate()) {
718 if (st->owner == owner && st->facilities.Test(StationFacility::Airport)) {
719 total_cost += _price[PR_INFRASTRUCTURE_AIRPORT] * st->airport.GetSpec()->maintenance_cost;
720 }
721 }
722 /* 3 bits fraction for the maintenance cost factor. */
723 return total_cost >> 3;
724}
725
726bool StationCompare::operator() (const Station *lhs, const Station *rhs) const
727{

Callers 3

CompaniesGenStatisticsFunction · 0.85

Calls 2

TestMethod · 0.80
GetSpecMethod · 0.45

Tested by

no test coverage detected