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

Function GetEmptyMask

src/station_cmd.cpp:504–512  ·  view source on GitHub ↗

* Get a mask of the cargo types that are empty at the station. * @param st Station to query * @return the empty mask */

Source from the content-addressed store, hash-verified

502 * @return the empty mask
503 */
504CargoTypes GetEmptyMask(const Station *st)
505{
506 CargoTypes mask = 0;
507
508 for (auto it = std::begin(st->goods); it != std::end(st->goods); ++it) {
509 if (it->TotalCount() == 0) SetBit(mask, std::distance(std::begin(st->goods), it));
510 }
511 return mask;
512}
513
514/**
515 * Add news item for when a station changes which cargoes it accepts.

Callers 2

Calls 4

SetBitFunction · 0.85
beginFunction · 0.50
endFunction · 0.50
TotalCountMethod · 0.45

Tested by

no test coverage detected