@@ -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
|
/* 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
|
* division by 0 if spawn date == last compression date. This matches
|
||||||
* LinkGraph::Monthly(). */
|
* LinkGraph::Monthly(). */
|
||||||
uint runtime = (job.StartDateTicks() / DAY_TICKS) - job.LastCompression() + 1;
|
uint runtime = _scaled_date_ticks - job.LastCompression() + 1;
|
||||||
for (auto &it : flows) {
|
for (auto &it : flows) {
|
||||||
it.ScaleToMonthly(runtime);
|
it.ScaleToMonthly(runtime);
|
||||||
}
|
}
|
||||||
|
@@ -5500,7 +5500,7 @@ void FlowStat::ReleaseShare(StationID st)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Scale all shares from link graph's runtime to monthly values.
|
* 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.
|
* @pre runtime must be greater than 0 as we don't want infinite flow values.
|
||||||
*/
|
*/
|
||||||
void FlowStat::ScaleToMonthly(uint runtime)
|
void FlowStat::ScaleToMonthly(uint runtime)
|
||||||
@@ -5508,7 +5508,7 @@ void FlowStat::ScaleToMonthly(uint runtime)
|
|||||||
assert(runtime > 0);
|
assert(runtime > 0);
|
||||||
uint share = 0;
|
uint share = 0;
|
||||||
for (iterator i = this->begin(); i != this->end(); ++i) {
|
for (iterator i = this->begin(); i != this->end(); ++i) {
|
||||||
share = std::max(share + 1, i->first * 30 / runtime);
|
share = std::max(share + 1, ClampTo<uint>((static_cast<uint64>(i->first) * 30 * DAY_TICKS * _settings_game.economy.day_length_factor) / runtime));
|
||||||
if (this->unrestricted == i->first) this->unrestricted = share;
|
if (this->unrestricted == i->first) this->unrestricted = share;
|
||||||
i->first = share;
|
i->first = share;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user