Add wrappers to get and update the current effective day length factor
This commit is contained in:
@@ -319,12 +319,12 @@ void StateGameLoop_LinkGraphPauseControl()
|
||||
DoCommandP(0, PM_PAUSED_LINK_GRAPH, 0, CMD_PAUSE);
|
||||
}
|
||||
} else if (_pause_mode == PM_UNPAUSED && _tick_skip_counter == 0) {
|
||||
if (_settings_game.economy.day_length_factor == 1) {
|
||||
if (DayLengthFactor() == 1) {
|
||||
if (_date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK - 2) return;
|
||||
if (_date.base() % _settings_game.linkgraph.recalc_interval != (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY) / 2) return;
|
||||
} else {
|
||||
int date_ticks = (NowDateTicks() - (LinkGraphSchedule::SPAWN_JOIN_TICK - 2)).base();
|
||||
int interval = std::max<int>(2, (_settings_game.linkgraph.recalc_interval * DAY_TICKS / (SECONDS_PER_DAY * _settings_game.economy.day_length_factor)));
|
||||
int interval = std::max<int>(2, (_settings_game.linkgraph.recalc_interval * DAY_TICKS / (SECONDS_PER_DAY * DayLengthFactor())));
|
||||
if (date_ticks % interval != interval / 2) return;
|
||||
}
|
||||
|
||||
@@ -355,12 +355,12 @@ void OnTick_LinkGraph()
|
||||
{
|
||||
int offset;
|
||||
int interval;
|
||||
if (_settings_game.economy.day_length_factor == 1) {
|
||||
if (DayLengthFactor() == 1) {
|
||||
if (_date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK) return;
|
||||
interval = _settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY;
|
||||
offset = _date.base() % interval;
|
||||
} else {
|
||||
interval = std::max<int>(2, (_settings_game.linkgraph.recalc_interval * DAY_TICKS / (SECONDS_PER_DAY * _settings_game.economy.day_length_factor)));
|
||||
interval = std::max<int>(2, (_settings_game.linkgraph.recalc_interval * DAY_TICKS / (SECONDS_PER_DAY * DayLengthFactor())));
|
||||
offset = (NowDateTicks() - LinkGraphSchedule::SPAWN_JOIN_TICK).base() % interval;
|
||||
}
|
||||
if (offset == 0) {
|
||||
|
Reference in New Issue
Block a user