mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 10:30:28 +00:00
(svn r25915) -Fix: Unrestricted flow was counted incorrectly when invalidating flow.
This commit is contained in:
parent
3ce2c4a5a3
commit
8926398f89
@ -4160,14 +4160,12 @@ void FlowStat::Invalidate()
|
|||||||
assert(!this->shares.empty());
|
assert(!this->shares.empty());
|
||||||
SharesMap new_shares;
|
SharesMap new_shares;
|
||||||
uint i = 0;
|
uint i = 0;
|
||||||
uint orig = 0;
|
|
||||||
for (SharesMap::iterator it(this->shares.begin()); it != this->shares.end(); ++it) {
|
for (SharesMap::iterator it(this->shares.begin()); it != this->shares.end(); ++it) {
|
||||||
new_shares[++i] = it->second;
|
new_shares[++i] = it->second;
|
||||||
orig += it->first;
|
if (it->first == this->unrestricted) this->unrestricted = i;
|
||||||
if (orig == this->unrestricted) this->unrestricted = orig;
|
|
||||||
}
|
}
|
||||||
this->shares.swap(new_shares);
|
this->shares.swap(new_shares);
|
||||||
assert(!this->shares.empty());
|
assert(!this->shares.empty() && this->unrestricted <= (--this->shares.end())->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user