File diff r8572:dcba9a2313b3 → r8573:c66e03190d64
src/station_cmd.cpp
Show inline comments
 
@@ -578,49 +578,49 @@ static void UpdateStationAcceptance(Stat
 
		MergePoint(&rect, st->airport_tile);
 
		MergePoint(&rect,
 
			st->airport_tile + TileDiffXY(afc->size_x - 1, afc->size_y - 1)
 
		);
 
	}
 

	
 
	if (st->dock_tile != 0) MergePoint(&rect, st->dock_tile);
 

	
 
	for (const RoadStop *rs = st->bus_stops; rs != NULL; rs = rs->next) {
 
		MergePoint(&rect, rs->xy);
 
	}
 

	
 
	for (const RoadStop *rs = st->truck_stops; rs != NULL; rs = rs->next) {
 
		MergePoint(&rect, rs->xy);
 
	}
 

	
 
	/* And retrieve the acceptance. */
 
	AcceptedCargo accepts;
 
	if (rect.max_x >= rect.min_x) {
 
		GetAcceptanceAroundTiles(
 
			accepts,
 
			TileXY(rect.min_x, rect.min_y),
 
			rect.max_x - rect.min_x + 1,
 
			rect.max_y - rect.min_y + 1,
 
			_patches.modified_catchment ? FindCatchmentRadius(st) : 4
 
			_patches.modified_catchment ? FindCatchmentRadius(st) : CA_UNMODIFIED
 
		);
 
	} else {
 
		memset(accepts, 0, sizeof(accepts));
 
	}
 

	
 
	/* Adjust in case our station only accepts fewer kinds of goods */
 
	for (CargoID i = 0; i < NUM_CARGO; i++) {
 
		uint amt = min(accepts[i], 15);
 

	
 
		/* Make sure the station can accept the goods type. */
 
		bool is_passengers = IsCargoInClass(i, CC_PASSENGERS);
 
		if ((!is_passengers && !(st->facilities & (byte)~FACIL_BUS_STOP)) ||
 
				(is_passengers && !(st->facilities & (byte)~FACIL_TRUCK_STOP)))
 
			amt = 0;
 

	
 
		SB(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, amt >= 8);
 
	}
 

	
 
	/* Only show a message in case the acceptance was actually changed. */
 
	uint new_acc = GetAcceptanceMask(st);
 
	if (old_acc == new_acc)
 
		return;
 

	
 
	/* show a message to report that the acceptance was changed? */
 
@@ -2691,49 +2691,49 @@ CommandCost CmdRenameStation(TileIndex t
 
* @param tile: Center tile to search from
 
* @param w: Width of the center
 
* @param h: Height of the center
 
*
 
* @return: Set of found stations
 
*/
 
StationSet FindStationsAroundIndustryTile(TileIndex tile, int w, int h)
 
{
 
	StationSet station_set;
 

	
 
	int w_prod; // width and height of the "producer" of the cargo
 
	int h_prod;
 
	int max_rad;
 
	if (_patches.modified_catchment) {
 
		w_prod = w;
 
		h_prod = h;
 
		w += 2 * MAX_CATCHMENT;
 
		h += 2 * MAX_CATCHMENT;
 
		max_rad = MAX_CATCHMENT;
 
	} else {
 
		w_prod = 0;
 
		h_prod = 0;
 
		w += 8;
 
		h += 8;
 
		max_rad = 4;
 
		max_rad = CA_UNMODIFIED;
 
	}
 

	
 
	BEGIN_TILE_LOOP(cur_tile, w, h, tile - TileDiffXY(max_rad, max_rad))
 
		cur_tile = TILE_MASK(cur_tile);
 
		if (!IsTileType(cur_tile, MP_STATION)) continue;
 

	
 
		Station *st = GetStationByTile(cur_tile);
 

	
 
		if (st->IsBuoy()) continue; // bouys don't accept cargo
 

	
 

	
 
		if (_patches.modified_catchment) {
 
			/* min and max coordinates of the producer relative */
 
			const int x_min_prod = max_rad + 1;
 
			const int x_max_prod = max_rad + w_prod;
 
			const int y_min_prod = max_rad + 1;
 
			const int y_max_prod = max_rad + h_prod;
 

	
 
			int rad = FindCatchmentRadius(st);
 

	
 
			int x_dist = min(w_cur - x_min_prod, x_max_prod - w_cur);
 
			if (w_cur < x_min_prod) {
 
				x_dist = x_min_prod - w_cur;
 
			} else if (w_cur > x_max_prod) {