Compare commits

...

3 Commits

@ -314,8 +314,8 @@ void DemandCalculator::CalcDemand(LinkGraphJob &job, const std::vector<bool> &re
if (this->mod_dist > 0) {
const int32_t distance = DistanceMaxPlusManhattan(job[from_id].XY(), job[to_id].XY());
/* Scale distance around base_distance by (mod_dist * (100 / 1024)).
* Note that this means that the distance range is always compressed because mod_dist <= 1024. */
scaled_distance = this->base_distance + (((distance - this->base_distance) * this->mod_dist) / 1024);
* mod_dist may be > 1024, so clamp result to be non-negative */
scaled_distance = std::max(0, this->base_distance + (((distance - this->base_distance) * this->mod_dist) / 1024));
}
/* Scale the accuracy by distance around accuracy / 2 */
@ -421,8 +421,15 @@ DemandCalculator::DemandCalculator(LinkGraphJob &job) :
this->accuracy = settings.accuracy;
this->mod_dist = settings.demand_distance;
if (this->mod_dist > 100) {
/* Increase effect of mod_dist > 100 */
this->mod_dist = 100 + ((this->mod_dist - 100) * 4);
/* Increase effect of mod_dist > 100.
* Quadratic:
* 100 --> 100
* 150 --> 308
* 200 --> 933
* 255 --> 2102
*/
int over100 = this->mod_dist - 100;
this->mod_dist = 100 + ((over100 * over100) / 12);
}
if (settings.GetDistributionType(cargo) == DT_MANUAL) return;

@ -64,6 +64,10 @@ public:
{
size_t len = SlGetStructListLength(INDUSTRY_NUM_INPUTS);
for (size_t j = 0; j < INDUSTRY_NUM_INPUTS; j++) {
i->accepts_cargo[j] = INVALID_CARGO;
}
for (size_t j = 0; j < len; j++) {
AcceptedCargo a = {};
SlObject(&a, this->GetDescription());
@ -119,6 +123,17 @@ public:
{
size_t len = SlGetStructListLength(INDUSTRY_NUM_OUTPUTS);
for (size_t j = 0; j < INDUSTRY_NUM_OUTPUTS; j++) {
i->produced_cargo[j] = INVALID_CARGO;
i->produced_cargo_waiting[j] = 0;
i->production_rate[j] = 0;
i->this_month_production[j] = 0;
i->this_month_transported[j] = 0;
i->last_month_production[j] = 0;
i->last_month_transported[j] = 0;
i->last_month_pct_transported[j] = 0;
}
for (size_t j = 0; j < len; j++) {
ProducedCargo p = {};
SlObject(&p, this->GetDescription());

@ -5081,6 +5081,19 @@ void BuildOilRig(TileIndex tile)
st->rect.BeforeAddTile(tile, StationRect::ADD_FORCE);
st->UpdateVirtCoord();
/* An industry tile has now been replaced with a station tile, this may change the overlap between station catchments and industry tiles.
* Recalculate the station catchment for all stations currently in the industry's nearby list.
* Clear the industry's station nearby list first because Station::RecomputeCatchment cannot remove nearby industries in this case. */
if (_settings_game.station.serve_neutral_industries) {
StationList nearby = std::move(st->industry->stations_near);
st->industry->stations_near.clear();
for (Station *near : nearby) {
near->RecomputeCatchment(true);
UpdateStationAcceptance(near, true);
}
}
st->RecomputeCatchment();
UpdateStationAcceptance(st, false);
ZoningMarkDirtyStationCoverageArea(st);

Loading…
Cancel
Save