OpenTTD Source  20241109-master-g5e4f8db7d6
linkgraphschedule.cpp File Reference

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

#include "../stdafx.h"
#include "linkgraphschedule.h"
#include "init.h"
#include "demands.h"
#include "mcf.h"
#include "flowmapper.h"
#include "../framerate_type.h"
#include "../command_func.h"
#include "../network/network.h"
#include "../misc_cmd.h"
#include "../safeguards.h"

Go to the source code of this file.

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().
 
void OnTick_LinkGraph ()
 Spawn or join a link graph job or compress a link graph if any link graph is due to do so.
 

Detailed Description

Definition of link graph schedule used for cargo distribution.

Definition in file linkgraphschedule.cpp.

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().