OpenTTD Source 20241224-master-gf74b0cf984
|
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. | |
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. | |
Definition of link graph schedule used for cargo distribution.
Definition in file linkgraphschedule.cpp.
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().
Definition at line 191 of file linkgraphschedule.cpp.
References _pause_mode, LinkGraphSchedule::instance, and PM_PAUSED_LINK_GRAPH.
Referenced by AfterLoadLinkGraphs().
void OnTick_LinkGraph | ( | ) |
Spawn or join a link graph job or compress a link graph if any link graph is due to do so.
Definition at line 202 of file linkgraphschedule.cpp.
References _network_server, _networking, _settings_game, TimerGameEconomy::date, TimerGameEconomy::date_fract, LinkGraphSchedule::instance, LinkGraphSchedule::JoinNext(), GameSettings::linkgraph, PFE_GL_LINKGRAPH, LinkGraphSettings::recalc_interval, TimerGameConst< struct Economy >::SECONDS_PER_DAY, PerformanceMeasurer::SetInactive(), LinkGraphSchedule::SPAWN_JOIN_TICK, and LinkGraphSchedule::SpawnNext().
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().