File diff r24481:a5bae7e5e10a → r24482:081733badf2c
src/station_cmd.cpp
Show inline comments
 
@@ -4010,23 +4010,24 @@ static bool CanMoveGoodsToStation(const 
 
		/* Non-passengers are never served by just a bus stop. */
 
		if (st->facilities == FACIL_BUS_STOP) return false;
 
	}
 
	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;
 
	if (amount == 0) return 0;
 

	
 
	Station *first_station = nullptr;
 
	typedef std::pair<Station *, uint> StationInfo;
 
	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
 
		 * improve performance in this common case. */
 
		if (first_station == nullptr) {
 
			first_station = st;