File diff r23428:4a18cf6bbfe5 → r23429:dad55774ae34
src/economy.cpp
Show inline comments
 
@@ -1035,26 +1035,27 @@ static SmallIndustryList _cargo_delivery
 
 */
 
static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint num_pieces, IndustryID source, CompanyID company)
 
{
 
	/* Find the nearest industrytile to the station sign inside the catchment area, whose industry accepts the cargo.
 
	 * This fails in three cases:
 
	 *  1) The station accepts the cargo because there are enough houses around it accepting the cargo.
 
	 *  2) The industries in the catchment area temporarily reject the cargo, and the daily station loop has not yet updated station acceptance.
 
	 *  3) The results of callbacks CBID_INDUSTRY_REFUSE_CARGO and CBID_INDTILE_CARGO_ACCEPTANCE are inconsistent. (documented behaviour)
 
	 */
 

	
 
	uint accepted = 0;
 

	
 
	for (uint i = 0; i < st->industries_near.Length() && num_pieces != 0; i++) {
 
		Industry *ind = st->industries_near[i];
 
	for (Industry *ind : st->industries_near) {
 
		if (num_pieces == 0) break;
 

	
 
		if (ind->index == source) continue;
 

	
 
		if (!_settings_game.station.serve_neutral_industries) {
 
			/* If this industry is only served by its neutral station, check it's us. */
 
			if (ind->neutral_station != NULL && ind->neutral_station != st) continue;
 
		}
 

	
 
		uint cargo_index;
 
		for (cargo_index = 0; cargo_index < lengthof(ind->accepts_cargo); cargo_index++) {
 
			if (cargo_type == ind->accepts_cargo[cargo_index]) break;
 
		}
 
		/* Check if matching cargo has been found */