Codechange: move all date-related variables inside the timer (#10706)
This commit is contained in:
@@ -163,10 +163,10 @@ LinkGraphSchedule::~LinkGraphSchedule()
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause the game if in 2 _date_fract ticks, we would do a join with the next
|
||||
* Pause the game if in 2 TimerGameCalendar::date_fract ticks, we would do a join with the next
|
||||
* link graph job, but it is still running.
|
||||
* The check is done 2 _date_fract ticks early instead of 1, as in multiplayer
|
||||
* calls to DoCommandP are executed after a delay of 1 _date_fract tick.
|
||||
* The check is done 2 TimerGameCalendar::date_fract ticks early instead of 1, as in multiplayer
|
||||
* calls to DoCommandP are executed after a delay of 1 TimerGameCalendar::date_fract tick.
|
||||
* If we previously paused, unpause if the job is now ready to be joined with.
|
||||
*/
|
||||
void StateGameLoop_LinkGraphPauseControl()
|
||||
@@ -177,10 +177,10 @@ void StateGameLoop_LinkGraphPauseControl()
|
||||
Command<CMD_PAUSE>::Post(PM_PAUSED_LINK_GRAPH, false);
|
||||
}
|
||||
} else if (_pause_mode == PM_UNPAUSED &&
|
||||
_date_fract == LinkGraphSchedule::SPAWN_JOIN_TICK - 2 &&
|
||||
_date % (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY) == (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY) / 2 &&
|
||||
TimerGameCalendar::date_fract == LinkGraphSchedule::SPAWN_JOIN_TICK - 2 &&
|
||||
TimerGameCalendar::date % (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY) == (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY) / 2 &&
|
||||
LinkGraphSchedule::instance.IsJoinWithUnfinishedJobDue()) {
|
||||
/* Perform check two _date_fract ticks before we would join, to make
|
||||
/* Perform check two TimerGameCalendar::date_fract ticks before we would join, to make
|
||||
* sure it also works in multiplayer. */
|
||||
Command<CMD_PAUSE>::Post(PM_PAUSED_LINK_GRAPH, true);
|
||||
}
|
||||
@@ -204,8 +204,8 @@ void AfterLoad_LinkGraphPauseControl()
|
||||
*/
|
||||
void OnTick_LinkGraph()
|
||||
{
|
||||
if (_date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK) return;
|
||||
Date offset = _date % (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY);
|
||||
if (TimerGameCalendar::date_fract != LinkGraphSchedule::SPAWN_JOIN_TICK) return;
|
||||
Date offset = TimerGameCalendar::date % (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY);
|
||||
if (offset == 0) {
|
||||
LinkGraphSchedule::instance.SpawnNext();
|
||||
} else if (offset == (_settings_game.linkgraph.recalc_interval / SECONDS_PER_DAY) / 2) {
|
||||
|
Reference in New Issue
Block a user