OpenTTD Source  20241121-master-g67a0fccfad
linkgraphschedule.h File Reference

Declaration of link graph schedule used for cargo distribution. More...

#include "linkgraph.h"

Go to the source code of this file.

Data Structures

class  ComponentHandler
 A handler doing "something" on a link graph component. More...
 
class  LinkGraphSchedule
 

Functions

void StateGameLoop_LinkGraphPauseControl ()
 Pause the game if in 2 TimerGameEconomy::date_fract ticks, we would do a join with the next link graph job, but it is still running. More...
 
void AfterLoad_LinkGraphPauseControl ()
 Pause the game on load if we would do a join with the next link graph job, but it is still running, and it would not be caught by a call to StateGameLoop_LinkGraphPauseControl().
 

Detailed Description

Declaration of link graph schedule used for cargo distribution.

Definition in file linkgraphschedule.h.

Function Documentation

◆ StateGameLoop_LinkGraphPauseControl()

void StateGameLoop_LinkGraphPauseControl ( )

Pause the game if in 2 TimerGameEconomy::date_fract ticks, we would do a join with the next link graph job, but it is still running.

The check is done 2 TimerGameEconomy::date_fract ticks early instead of 1, as in multiplayer calls to DoCommandP are executed after a delay of 1 TimerGameEconomy::date_fract tick. If we previously paused, unpause if the job is now ready to be joined with.

Definition at line 169 of file linkgraphschedule.cpp.

References _pause_mode, _settings_game, TimerGameEconomy::date, TimerGameEconomy::date_fract, LinkGraphSchedule::instance, LinkGraphSchedule::IsJoinWithUnfinishedJobDue(), GameSettings::linkgraph, PM_PAUSED_LINK_GRAPH, PM_UNPAUSED, LinkGraphSettings::recalc_interval, TimerGameConst< struct Economy >::SECONDS_PER_DAY, and LinkGraphSchedule::SPAWN_JOIN_TICK.

Referenced by StateGameLoop().