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

Function OnTick_Station

src/station_cmd.cpp:4342–4367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4340}
4341
4342void OnTick_Station()
4343{
4344 if (_game_mode == GM_EDITOR) return;
4345
4346 for (BaseStation *st : BaseStation::Iterate()) {
4347 StationHandleSmallTick(st);
4348
4349 /* Clean up the link graph about once a week. */
4350 if (Station::IsExpected(st) && (TimerGameTick::counter + st->index) % Ticks::STATION_LINKGRAPH_TICKS == 0) {
4351 DeleteStaleLinks(Station::From(st));
4352 };
4353
4354 /* Spread out big-tick over STATION_ACCEPTANCE_TICKS ticks. */
4355 if ((TimerGameTick::counter + st->index) % Ticks::STATION_ACCEPTANCE_TICKS == 0) {
4356 /* Stop processing this station if it was deleted */
4357 if (!StationHandleBigTick(st)) continue;
4358 }
4359
4360 /* Spread out station animation over STATION_ACCEPTANCE_TICKS ticks. */
4361 if ((TimerGameTick::counter + st->index) % Ticks::STATION_ACCEPTANCE_TICKS == 0) {
4362 TriggerStationAnimation(st, st->xy, StationAnimationTrigger::AcceptanceTick);
4363 TriggerRoadStopAnimation(st, st->xy, StationAnimationTrigger::AcceptanceTick);
4364 if (Station::IsExpected(st)) TriggerAirportAnimation(Station::From(st), AirportAnimationTrigger::AcceptanceTick);
4365 }
4366 }
4367}
4368
4369/** Economy monthly loop for stations. */
4370static const IntervalTimer<TimerGameEconomy> _economy_stations_monthly({TimerGameEconomy::MONTH, TimerGameEconomy::Priority::STATION}, [](auto)

Callers 1

CallLandscapeTickFunction · 0.85

Calls 6

StationHandleSmallTickFunction · 0.85
DeleteStaleLinksFunction · 0.85
StationHandleBigTickFunction · 0.85
TriggerStationAnimationFunction · 0.85
TriggerRoadStopAnimationFunction · 0.85
TriggerAirportAnimationFunction · 0.85

Tested by

no test coverage detected