summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/economy.cpp102
1 files changed, 0 insertions, 102 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index e6084e654..d044d02ab 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -868,104 +868,6 @@ Money GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, C
return BigMulS(dist * time_factor * num_pieces, _cargo_payment_rates[cargo_type], 21);
}
-/**
- * @note THIS STRUCTURE WILL BE REMOVED SOON!
- */
-struct FindIndustryToDeliverData {
- const Rect *rect; ///< Station acceptance rectangle
- CargoID cargo_type; ///< Cargo type that was delivered
-
- Industry *ind; ///< Returns found industry
- const IndustrySpec *indspec; ///< Spec of ind
- uint cargo_index; ///< Index of cargo_type in acceptance list of ind
-};
-
-/**
- * @note THIS FUNCTION WILL BE REMOVED SOON!
- */
-static bool FindIndustryToDeliver(TileIndex ind_tile, void *user_data)
-{
- FindIndustryToDeliverData *callback_data = (FindIndustryToDeliverData *)user_data;
- const Rect *rect = callback_data->rect;
- CargoID cargo_type = callback_data->cargo_type;
-
- /* Only process industry tiles */
- if (!IsTileType(ind_tile, MP_INDUSTRY)) return false;
-
- /* Only process tiles in the station acceptance rectangle */
- int x = TileX(ind_tile);
- int y = TileY(ind_tile);
- if (x < rect->left || x > rect->right || y < rect->top || y > rect->bottom) return false;
-
- Industry *ind = GetIndustryByTile(ind_tile);
- const IndustrySpec *indspec = GetIndustrySpec(ind->type);
-
- 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 */
- if (cargo_index >= lengthof(ind->accepts_cargo)) return false;
-
- /* Check if industry temporarly refuses acceptance */
- if (HasBit(indspec->callback_flags, CBM_IND_REFUSE_CARGO)) {
- uint16 res = GetIndustryCallback(CBID_INDUSTRY_REFUSE_CARGO, 0, GetReverseCargoTranslation(cargo_type, indspec->grf_prop.grffile), ind, ind->type, ind->xy);
- if (res == 0) return false;
- }
-
- /* Found industry accepting the cargo */
- callback_data->ind = ind;
- callback_data->indspec = indspec;
- callback_data->cargo_index = cargo_index;
- return true;
-}
-
-/**
- * Transfer goods from station to industry.
- * All cargo is delivered to the nearest (Manhattan) industry to the station sign, which is inside the acceptance rectangle and actually accepts the cargo.
- * @param st The station that accepted the cargo
- * @param cargo_type Type of cargo delivered
- * @param nun_pieces Amount of cargo delivered
- * @note THIS FUNCTION WILL BE REMOVED SOON!
- */
-static Industry *DeliverGoodsToIndustryCheckOldStyle(const Station *st, CargoID cargo_type, int num_pieces)
-{
- if (st->rect.IsEmpty()) return NULL;
-
- /* Compute acceptance rectangle */
- int catchment_radius = st->GetCatchmentRadius();
- Rect rect = {
- max<int>(st->rect.left - catchment_radius, 0),
- max<int>(st->rect.top - catchment_radius, 0),
- min<int>(st->rect.right + catchment_radius, MapMaxX()),
- min<int>(st->rect.bottom + catchment_radius, MapMaxY())
- };
-
- /* Compute maximum extent of acceptance rectangle wrt. station sign */
- TileIndex start_tile = st->xy;
- uint max_radius = max(
- max(DistanceManhattan(start_tile, TileXY(rect.left , rect.top)), DistanceManhattan(start_tile, TileXY(rect.left , rect.bottom))),
- max(DistanceManhattan(start_tile, TileXY(rect.right, rect.top)), DistanceManhattan(start_tile, TileXY(rect.right, rect.bottom)))
- );
-
- FindIndustryToDeliverData callback_data;
- callback_data.rect = &rect;
- callback_data.cargo_type = cargo_type;
- callback_data.ind = NULL;
- callback_data.indspec = NULL;
- callback_data.cargo_index = 0;
-
- /* 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)
- */
- if (CircularTileSearch(&start_tile, 2 * max_radius + 1, FindIndustryToDeliver, &callback_data)) return callback_data.ind;
-
- return NULL;
-}
-
/** The industries we've currently brought cargo to. */
static SmallIndustryList _cargo_delivery_destinations;
@@ -1005,14 +907,10 @@ static void DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, int nu
/* Insert the industry into _cargo_delivery_destinations, if not yet contained */
_cargo_delivery_destinations.Include(ind);
- assert(DeliverGoodsToIndustryCheckOldStyle(st, cargo_type, num_pieces) == ind); // safety check, will be removed soon
-
ind->incoming_cargo_waiting[cargo_index] = min(num_pieces + ind->incoming_cargo_waiting[cargo_index], 0xFFFF);
return;
}
-
- assert(DeliverGoodsToIndustryCheckOldStyle(st, cargo_type, num_pieces) == NULL); // safety check, will be removed soon
}
/**