(svn r25424) -Fix: keep old flows around in an invalidated state to continue routing cargo if necessary

This commit is contained in:
fonsinchen
2013-06-17 20:38:11 +00:00
parent b923eb31a8
commit f0119308f6
3 changed files with 38 additions and 1 deletions

View File

@@ -79,6 +79,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
@@ -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).
};