Feature: Set exclusive access to industry from GS (#8115)

(cherry picked from commit 9a45a0f535)
This commit is contained in:
Pavel Stupnikov
2020-12-22 16:29:48 +03:00
committed by Jonathan G Rennison
parent 4d97fbc814
commit f39a00d676
11 changed files with 137 additions and 5 deletions

View File

@@ -4328,7 +4328,7 @@ static bool CanMoveGoodsToStation(const Station *st, CargoID type)
return true;
}
uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, SourceID source_id, const StationList *all_stations)
uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, SourceID source_id, const StationList *all_stations, Owner exclusivity)
{
/* Return if nothing to do. Also the rounding below fails for 0. */
if (all_stations->empty()) return 0;
@@ -4339,6 +4339,7 @@ uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, Sourc
std::vector<StationInfo> used_stations;
for (Station *st : *all_stations) {
if (exclusivity != INVALID_OWNER && exclusivity != st->owner) continue;
if (!CanMoveGoodsToStation(st, type)) continue;
/* Avoid allocating a vector if there is only one station to significantly