diff --git a/src/linkgraph/flowmapper.cpp b/src/linkgraph/flowmapper.cpp index 240ea52004..79e03b0123 100644 --- a/src/linkgraph/flowmapper.cpp +++ b/src/linkgraph/flowmapper.cpp @@ -53,7 +53,7 @@ void FlowMapper::Run(LinkGraphJob &job) const /* Scale by time the graph has been running without being compressed. Add 1 to avoid * division by 0 if spawn date == last compression date. This matches * LinkGraph::Monthly(). */ - uint runtime = (job.StartDateTicks() / DAY_TICKS) - job.LastCompression() + 1; + uint runtime = _scaled_date_ticks - job.LastCompression() + 1; for (auto &it : flows) { it.ScaleToMonthly(runtime); } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 5f52d46ae7..cde553890d 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -5500,7 +5500,7 @@ void FlowStat::ReleaseShare(StationID st) /** * Scale all shares from link graph's runtime to monthly values. - * @param runtime Time the link graph has been running without compression. + * @param runtime Time the link graph has been running without compression, in scaled ticks. * @pre runtime must be greater than 0 as we don't want infinite flow values. */ void FlowStat::ScaleToMonthly(uint runtime) @@ -5508,7 +5508,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, i->first * 30 / runtime); + share = std::max(share + 1, ClampTo((static_cast(i->first) * 30 * DAY_TICKS * _settings_game.economy.day_length_factor) / runtime)); if (this->unrestricted == i->first) this->unrestricted = share; i->first = share; }