Functions | Variables

# linkgraph.cpp File Reference

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

`#include "../stdafx.h"`
`#include "../map_func.h"`
`#include "../core/bitmath_func.hpp"`
`#include "../debug.h"`
`#include "../window_func.h"`
`#include "../window_gui.h"`
`#include "linkgraph.h"`
`#include "demands.h"`
`#include "mcf.h"`
`#include "flowmapper.h"`
`#include <queue>`

Go to the source code of this file.

## Functions
void | OnTick_LinkGraph ()
| Spawn or join a link graph component if any link graph is due to do so.
void | InitializeLinkGraphs ()
| Initialize all link graphs.
## Variables
LinkGraph | _link_graphs [NUM_CARGO]
| Global array of link graphs, one for each cargo.

## Detailed Description

Definition of link graph classes used for cargo distribution.

Definition in file linkgraph.cpp.

## Function Documentation

void InitializeLinkGraphs | ( |  | ) |

Initialize all link graphs.

Used when loading a game.

Definition at line 519 of file linkgraph.cpp.

References LinkGraphJob::AddHandler(), and LinkGraphJob::ClearHandlers().

Referenced by ShutdownGame().

void OnTick_LinkGraph | ( |  | ) |

Spawn or join a link graph component if any link graph is due to do so.

Spawning is done on COMPONENTS_SPAWN_TICK every day, joining on COMPONENT_JOIN_TICK. Each link graph is due every recalc_interval days.

Definition at line 182 of file linkgraph.cpp.

References _date, _date_fract, _settings_game, LinkGraph::COMPONENTS_JOIN_TICK, LinkGraph::COMPONENTS_SPAWN_TICK, LinkGraph::Join(), GameSettings::linkgraph, LinkGraph::NextComponent(), NUM_CARGO, and LinkGraphSettings::recalc_interval.