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

Method AddFlow

src/station_cmd.cpp:5214–5223  ·  view source on GitHub ↗

* Add some flow from "origin", going via "via". * @param origin Origin of the flow. * @param via Next hop. * @param flow Amount of flow to be added. */

Source from the content-addressed store, hash-verified

5212 * @param flow Amount of flow to be added.
5213 */
5214void FlowStatMap::AddFlow(StationID origin, StationID via, uint flow)
5215{
5216 FlowStatMap::iterator origin_it = this->find(origin);
5217 if (origin_it == this->end()) {
5218 this->emplace(origin, FlowStat(via, flow));
5219 } else {
5220 origin_it->second.ChangeShare(via, flow);
5221 assert(!origin_it->second.GetShares()->empty());
5222 }
5223}
5224
5225/**
5226 * Pass on some flow, remembering it as invalid, for later subtraction from

Callers

nothing calls this directly

Calls 6

FlowStatClass · 0.85
ChangeShareMethod · 0.80
GetSharesMethod · 0.80
findMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected