Add wrappers to get and update the current effective day length factor

This commit is contained in:
Jonathan G Rennison
2024-02-09 19:39:58 +00:00
parent db8b77a72e
commit 516e8defb5
20 changed files with 66 additions and 42 deletions

View File

@@ -4472,7 +4472,7 @@ void DeleteStaleLinks(Station *from)
Station *to = Station::Get((*lg)[to_id].Station());
assert(to->goods[c].node == to_id);
assert(_date >= edge.LastUpdate());
DateDelta timeout = std::max<uint>((LinkGraph::MIN_TIMEOUT_DISTANCE + (DistanceManhattan(from->xy, to->xy) >> 3)) / _settings_game.economy.day_length_factor, 1);
DateDelta timeout = std::max<uint>((LinkGraph::MIN_TIMEOUT_DISTANCE + (DistanceManhattan(from->xy, to->xy) >> 3)) / DayLengthFactor(), 1);
if (edge.LastAircraftUpdate() != INVALID_DATE && (_date - edge.LastAircraftUpdate()) > timeout) {
edge.ClearAircraft();
}
@@ -5524,7 +5524,7 @@ void FlowStat::ScaleToMonthly(uint runtime)
assert(runtime > 0);
uint share = 0;
for (iterator i = this->begin(); i != this->end(); ++i) {
share = std::max(share + 1, ClampTo<uint>((static_cast<uint64_t>(i->first) * 30 * DAY_TICKS * _settings_game.economy.day_length_factor) / runtime));
share = std::max(share + 1, ClampTo<uint>((static_cast<uint64_t>(i->first) * 30 * DAY_TICKS * DayLengthFactor()) / runtime));
if (this->unrestricted == i->first) this->unrestricted = share;
i->first = share;
}