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

Function CountActiveStations

src/town_cmd.cpp:3819–3828  ·  view source on GitHub ↗

* Calculates amount of active stations in the range of town (HZB_TOWN_EDGE). * @param t The town to calculate stations for * @returns Amount of active stations */

Source from the content-addressed store, hash-verified

3817 * @returns Amount of active stations
3818 */
3819static int CountActiveStations(Town *t)
3820{
3821 int n = 0;
3822 ForAllStationsNearTown(t, [&](const Station * st) {
3823 if (st->time_since_load <= 20 || st->time_since_unload <= 20) {
3824 n++;
3825 }
3826 });
3827 return n;
3828}
3829
3830/**
3831 * Calculates town growth rate in normal conditions (custom growth rate not set).

Callers 2

GetNormalGrowthRateFunction · 0.85
UpdateTownGrowthFunction · 0.85

Calls 1

ForAllStationsNearTownFunction · 0.85

Tested by

no test coverage detected