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

Method DeleteFlows

src/station_cmd.cpp:5276–5290  ·  view source on GitHub ↗

* Delete all flows at a station for specific cargo and destination. * @param via Remote station of flows to be deleted. * @return IDs of source stations for which the complete FlowStat, not only a * share, has been erased. */

Source from the content-addressed store, hash-verified

5274 * share, has been erased.
5275 */
5276std::vector<StationID> FlowStatMap::DeleteFlows(StationID via)
5277{
5278 std::vector<StationID> ret;
5279 for (FlowStatMap::iterator f_it = this->begin(); f_it != this->end();) {
5280 FlowStat &s_flows = f_it->second;
5281 s_flows.ChangeShare(via, INT_MIN);
5282 if (s_flows.GetShares()->empty()) {
5283 ret.push_back(f_it->first);
5284 this->erase(f_it++);
5285 } else {
5286 ++f_it;
5287 }
5288 }
5289 return ret;
5290}
5291
5292/**
5293 * Restrict all flows at a station for specific cargo and destination.

Callers 3

DeleteStaleLinksFunction · 0.80
~StationMethod · 0.80
~LinkGraphJobMethod · 0.80

Calls 7

ChangeShareMethod · 0.80
GetSharesMethod · 0.80
push_backMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected