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

Function TriggerWatchedCargoCallbacks

src/station_cmd.cpp:3892–3910  ·  view source on GitHub ↗

* Run the watched cargo callback for all houses in the catchment area. * @param st Station. */

Source from the content-addressed store, hash-verified

3890 * @param st Station.
3891 */
3892void TriggerWatchedCargoCallbacks(Station *st)
3893{
3894 /* Collect cargoes accepted since the last big tick. */
3895 CargoTypes cargoes = 0;
3896 for (CargoType cargo_type = 0; cargo_type < NUM_CARGO; cargo_type++) {
3897 if (st->goods[cargo_type].status.Test(GoodsEntry::State::AcceptedBigtick)) SetBit(cargoes, cargo_type);
3898 }
3899
3900 /* Anything to do? */
3901 if (cargoes == 0) return;
3902
3903 /* Loop over all houses in the catchment. */
3904 BitmapTileIterator it(st->catchment_tiles);
3905 for (TileIndex tile = it; tile != INVALID_TILE; tile = ++it) {
3906 if (IsTileType(tile, MP_HOUSE)) {
3907 TriggerHouseAnimation_WatchedCargoAccepted(tile, cargoes);
3908 }
3909 }
3910}
3911
3912/**
3913 * This function is called for each station once every 250 ticks.

Callers 1

StationHandleBigTickFunction · 0.85

Calls 4

SetBitFunction · 0.85
IsTileTypeFunction · 0.85
TestMethod · 0.80

Tested by

no test coverage detected