Codechange: Use EnumBitSet for PauseMode. (#13553)

This commit is contained in:
Peter Nelson
2025-02-14 08:30:04 +00:00
committed by GitHub
parent 3518d7e0f1
commit 6cf7a899e9
27 changed files with 113 additions and 118 deletions

View File

@@ -168,18 +168,18 @@ LinkGraphSchedule::~LinkGraphSchedule()
*/
void StateGameLoop_LinkGraphPauseControl()
{
if (_pause_mode & PM_PAUSED_LINK_GRAPH) {
if (_pause_mode.Test(PauseMode::LinkGraph)) {
/* We are paused waiting on a job, check the job every tick. */
if (!LinkGraphSchedule::instance.IsJoinWithUnfinishedJobDue()) {
Command<CMD_PAUSE>::Post(PM_PAUSED_LINK_GRAPH, false);
Command<CMD_PAUSE>::Post(PauseMode::LinkGraph, false);
}
} else if (_pause_mode == PM_UNPAUSED &&
} else if (_pause_mode.None() &&
TimerGameEconomy::date_fract == LinkGraphSchedule::SPAWN_JOIN_TICK - 2 &&
TimerGameEconomy::date.base() % (_settings_game.linkgraph.recalc_interval / EconomyTime::SECONDS_PER_DAY) == (_settings_game.linkgraph.recalc_interval / EconomyTime::SECONDS_PER_DAY) / 2 &&
LinkGraphSchedule::instance.IsJoinWithUnfinishedJobDue()) {
/* Perform check two TimerGameEconomy::date_fract ticks before we would join, to make
* sure it also works in multiplayer. */
Command<CMD_PAUSE>::Post(PM_PAUSED_LINK_GRAPH, true);
Command<CMD_PAUSE>::Post(PauseMode::LinkGraph, true);
}
}
@@ -191,7 +191,7 @@ void StateGameLoop_LinkGraphPauseControl()
void AfterLoad_LinkGraphPauseControl()
{
if (LinkGraphSchedule::instance.IsJoinWithUnfinishedJobDue()) {
_pause_mode |= PM_PAUSED_LINK_GRAPH;
_pause_mode.Set(PauseMode::LinkGraph);
}
}