summaryrefslogtreecommitdiff
path: root/src/station_base.h
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-06-17 20:38:11 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-06-17 20:38:11 +0000
commitf0119308f602c9435c793b95b0fa9af3be3a5296 (patch)
tree63bb3de599615feed1d36dc6c525e32b76476f08 /src/station_base.h
parentb923eb31a8ca78cfc4f7e5be00b5f158edbb7588 (diff)
downloadopenttd-f0119308f602c9435c793b95b0fa9af3be3a5296.tar.xz
(svn r25424) -Fix: keep old flows around in an invalidated state to continue routing cargo if necessary
Diffstat (limited to 'src/station_base.h')
-rw-r--r--src/station_base.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/station_base.h b/src/station_base.h
index 1eb5e0422..280df69d7 100644
--- a/src/station_base.h
+++ b/src/station_base.h
@@ -80,6 +80,13 @@ public:
inline const SharesMap *GetShares() const { return &this->shares; }
/**
+ * Swap the shares maps, and thus the content of this FlowStat with the
+ * other one.
+ * @param other FlowStat to swap with.
+ */
+ inline void SwapShares(FlowStat &other) { this->shares.swap(other.shares); }
+
+ /**
* Get a station a package can be routed to. This done by drawing a
* random number between 0 and sum_shares and then looking that up in
* the map with lower_bound. So each share gets selected with a
@@ -94,6 +101,8 @@ public:
StationID GetVia(StationID excluded, StationID excluded2 = INVALID_STATION) const;
+ void Invalidate();
+
private:
SharesMap shares; ///< Shares of flow to be sent via specified station (or consumed locally).
};