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

Function TownHistoryHelper

src/newgrf_town.cpp:19–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18template <typename Tproj>
19static uint16_t TownHistoryHelper(const Town *t, CargoLabel label, uint period, Tproj proj)
20{
21 auto it = t->GetCargoSupplied(GetCargoTypeByLabel(label));
22 if (it == std::end(t->supplied)) return 0;
23
24 return ClampTo<uint16_t>(std::invoke(proj, it->history[period]));
25}
26
27/* virtual */ uint32_t TownScopeResolver::GetVariable(uint8_t variable, [[maybe_unused]] uint32_t parameter, bool &available) const
28{

Callers 1

GetVariableMethod · 0.85

Calls 3

GetCargoTypeByLabelFunction · 0.85
GetCargoSuppliedMethod · 0.80
endFunction · 0.50

Tested by

no test coverage detected