summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-10-27 11:51:14 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-10-27 11:51:14 +0000
commit8926398f896f2f6b6ba1d43267dbf04f5404e3c3 (patch)
tree1fa11e6d917889000954bc45367116f99b254986 /src
parent3ce2c4a5a3ef5fdd30978e5683f6c09d7965702e (diff)
downloadopenttd-8926398f896f2f6b6ba1d43267dbf04f5404e3c3.tar.xz
(svn r25915) -Fix: Unrestricted flow was counted incorrectly when invalidating flow.
Diffstat (limited to 'src')
-rw-r--r--src/station_cmd.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index ca0c0be05..004202c5b 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -4160,14 +4160,12 @@ void FlowStat::Invalidate()
assert(!this->shares.empty());
SharesMap new_shares;
uint i = 0;
- uint orig = 0;
for (SharesMap::iterator it(this->shares.begin()); it != this->shares.end(); ++it) {
new_shares[++i] = it->second;
- orig += it->first;
- if (orig == this->unrestricted) this->unrestricted = orig;
+ if (it->first == this->unrestricted) this->unrestricted = i;
}
this->shares.swap(new_shares);
- assert(!this->shares.empty());
+ assert(!this->shares.empty() && this->unrestricted <= (--this->shares.end())->first);
}
/**