Changeset - r20871:d965d79314c1
[Not reviewed]
master
0 1 0
fonsinchen - 11 years ago 2013-10-27 11:51:14
fonsinchen@openttd.org
(svn r25915) -Fix: Unrestricted flow was counted incorrectly when invalidating flow.
1 file changed with 2 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/station_cmd.cpp
Show inline comments
 
@@ -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);
 
}
 

	
 
/**
0 comments (0 inline, 0 general)