summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-11-10 15:18:49 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-11-10 15:18:49 +0000
commit962d6d7e4877b5d1fd8717bb08d79f1d6689a934 (patch)
tree37721d24de5707fdf51ab41017ba94bab6dd30a8 /src/station_cmd.cpp
parent9b68e4f8644a2750d537a7cbc474914aea4944ef (diff)
downloadopenttd-962d6d7e4877b5d1fd8717bb08d79f1d6689a934.tar.xz
(svn r25963) -Fix [FS#5758]: Mixtures of old and new flows could create cycles.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 6ed0fbf94..0bed79582 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -4352,18 +4352,23 @@ void FlowStatMap::FinalizeLocalConsumption(StationID self)
/**
* 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.
*/
-void FlowStatMap::DeleteFlows(StationID via)
+StationIDStack FlowStatMap::DeleteFlows(StationID via)
{
+ StationIDStack ret;
for (FlowStatMap::iterator f_it = this->begin(); f_it != this->end();) {
FlowStat &s_flows = f_it->second;
s_flows.ChangeShare(via, INT_MIN);
if (s_flows.GetShares()->empty()) {
+ ret.Push(f_it->first);
this->erase(f_it++);
} else {
++f_it;
}
}
+ return ret;
}
/**