File diff r24596:eddf98238034 → r24597:afde5721a3b6
src/linkgraph/linkgraphjob.cpp
Show inline comments
 
@@ -220,14 +220,14 @@ void LinkGraphJob::NodeAnnotation::Init(
 
 * @param cap Maximum capacity of the new leg.
 
 * @param free_cap Remaining free capacity of the new leg.
 
 * @param dist Distance of the new leg.
 
 */
 
void Path::Fork(Path *base, uint cap, int free_cap, uint dist)
 
{
 
	this->capacity = min(base->capacity, cap);
 
	this->free_capacity = min(base->free_capacity, free_cap);
 
	this->capacity = std::min(base->capacity, cap);
 
	this->free_capacity = std::min(base->free_capacity, free_cap);
 
	this->distance = base->distance + dist;
 
	assert(this->distance > 0);
 
	if (this->parent != base) {
 
		this->Detach();
 
		this->parent = base;
 
		this->parent->num_children++;
 
@@ -247,13 +247,13 @@ uint Path::AddFlow(uint new_flow, LinkGr
 
{
 
	if (this->parent != nullptr) {
 
		LinkGraphJob::Edge edge = job[this->parent->node][this->node];
 
		if (max_saturation != UINT_MAX) {
 
			uint usable_cap = edge.Capacity() * max_saturation / 100;
 
			if (usable_cap > edge.Flow()) {
 
				new_flow = min(new_flow, usable_cap - edge.Flow());
 
				new_flow = std::min(new_flow, usable_cap - edge.Flow());
 
			} else {
 
				return 0;
 
			}
 
		}
 
		new_flow = this->parent->AddFlow(new_flow, job, max_saturation);
 
		if (this->flow == 0 && new_flow > 0) {