Link graph: Check for unfinished jobs 2 ticks before join instead of 1
This is to fix pausing multiplayer servers at daylength = 1
This commit is contained in:
@@ -108,7 +108,7 @@ void LinkGraphSchedule::SpawnNext()
|
||||
bool LinkGraphSchedule::IsJoinWithUnfinishedJobDue() const
|
||||
{
|
||||
for (JobList::const_iterator it = this->running.begin(); it != this->running.end(); ++it) {
|
||||
if (!((*it)->IsFinished(1))) {
|
||||
if (!((*it)->IsFinished(2))) {
|
||||
/* job is not due to be joined yet */
|
||||
return false;
|
||||
}
|
||||
@@ -321,10 +321,10 @@ void StateGameLoop_LinkGraphPauseControl()
|
||||
}
|
||||
} else if (_pause_mode == PM_UNPAUSED && _tick_skip_counter == 0) {
|
||||
if (!_settings_game.linkgraph.recalc_not_scaled_by_daylength || _settings_game.economy.day_length_factor == 1) {
|
||||
if (_date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK - 1) return;
|
||||
if (_date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK - 2) return;
|
||||
if (_date % _settings_game.linkgraph.recalc_interval != _settings_game.linkgraph.recalc_interval / 2) return;
|
||||
} else {
|
||||
int date_ticks = ((_date * DAY_TICKS) + _date_fract - (LinkGraphSchedule::SPAWN_JOIN_TICK - 1));
|
||||
int date_ticks = ((_date * DAY_TICKS) + _date_fract - (LinkGraphSchedule::SPAWN_JOIN_TICK - 2));
|
||||
int interval = max<int>(2, (_settings_game.linkgraph.recalc_interval * DAY_TICKS / _settings_game.economy.day_length_factor));
|
||||
if (date_ticks % interval != interval / 2) return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user