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

Method GetShare

src/station_cmd.cpp:4986–4997  ·  view source on GitHub ↗

* Get flow for a station. * @param st Station to get flow for. * @return Flow for st. */

Source from the content-addressed store, hash-verified

4984 * @return Flow for st.
4985 */
4986uint FlowStat::GetShare(StationID st) const
4987{
4988 uint32_t prev = 0;
4989 for (const auto &it : this->shares) {
4990 if (it.second == st) {
4991 return it.first - prev;
4992 } else {
4993 prev = it.first;
4994 }
4995 }
4996 return 0;
4997}
4998
4999/**
5000 * Get a station a package can be routed to, but exclude the given ones.

Callers 3

GetFlowViaMethod · 0.80
GetFlowFromViaMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected