Conditional orders: Add mode to check waiting station cargo via next node

This commit is contained in:
Jonathan G Rennison
2020-05-10 15:21:03 +01:00
parent 1c768705a1
commit 0100ea4e32
8 changed files with 165 additions and 31 deletions

View File

@@ -946,6 +946,15 @@ uint StationCargoList::ShiftCargo(Taction action, StationIDStack next, bool incl
return max_move - action.MaxMove();
}
uint StationCargoList::AvailableViaCount(StationID next) const
{
uint count = 0;
for (ConstIterator it = this->packets.lower_bound(next); it != this->packets.end() && it.GetKey() == next; ++it) {
count += (*it)->count;
}
return count;
}
/**
* Truncates where each destination loses roughly the same percentage of its
* cargo. This is done by randomizing the selection of packets to be removed.