Code handling saving and loading of link graphs. More...
#include "../linkgraph/linkgraph.h"
#include "../linkgraph/demands.h"
#include "../settings_internal.h"
#include "saveload.h"
#include <vector>
Go to the source code of this file.
Functions | |
const SettingDesc * | GetSettingDescription (uint index) |
const SaveLoad * | GetLinkGraphDesc () |
Get a SaveLoad array for a link graph. | |
static void | SaveLoad_LinkGraphComponent (LinkGraphComponent &comp) |
Save/load a component of a link graph. | |
static void | DoSave_LGRP (void *) |
Save all link graphs. | |
static void | Load_LGRP () |
Load all link graphs. | |
void | AfterLoadLinkGraphs () |
Spawn the threads for running link graph calculations. | |
static void | Save_LGRP () |
Variables | |
static const SaveLoad | _node_desc [] |
SaveLoad desc for a link graph node. | |
static const SaveLoad | _edge_desc [] |
SaveLoad desc for a link graph edge. | |
const ChunkHandler | _linkgraph_chunk_handlers [] |
Code handling saving and loading of link graphs.
Definition in file linkgraph_sl.cpp.
void AfterLoadLinkGraphs | ( | ) |
Spawn the threads for running link graph calculations.
Has to be done after loading as the cargo classes might have changed.
Definition at line 143 of file linkgraph_sl.cpp.
References _link_graphs, LinkGraphComponent::GetSize(), and LinkGraphJob::SpawnThread().
Referenced by AfterLoadGame().
const SaveLoad* GetLinkGraphDesc | ( | ) |
Get a SaveLoad array for a link graph.
The settings struct is derived from the global settings saveload array. The exact entries are calculated when the function is called the first time. It's necessary to keep a copy of the settings for each link graph so that you can change the settings while in-game and still not mess with current link graph runs. Of course the settings have to be saved and loaded, too, to avoid desyncs.
Definition at line 29 of file linkgraph_sl.cpp.
References SaveLoad::address, SaveLoad::cmd, SettingDesc::desc, SettingDescBase::name, SettingDesc::save, SL_MAX_VERSION, SLE_CONDVAR, and SLE_END.
Referenced by DoSave_LGRP(), and Load_LGRP().
static void SaveLoad_LinkGraphComponent | ( | LinkGraphComponent & | comp | ) | [static] |
Save/load a component of a link graph.
comp | the component to be saved or loaded |
Definition at line 97 of file linkgraph_sl.cpp.
References LinkGraphComponent::GetEdge(), LinkGraphComponent::GetNode(), LinkGraphComponent::GetSize(), and SlObject().
Referenced by DoSave_LGRP(), and Load_LGRP().
const SaveLoad _edge_desc[] [static] |
{ SLE_CONDVAR(Edge, distance, SLE_UINT32, SL_COMPONENTS, SL_MAX_VERSION), SLE_CONDVAR(Edge, capacity, SLE_UINT32, SL_COMPONENTS, SL_MAX_VERSION), SLE_CONDVAR(Edge, next_edge, SLE_UINT32, SL_MCF, SL_MAX_VERSION), }
SaveLoad desc for a link graph edge.
Definition at line 86 of file linkgraph_sl.cpp.
const ChunkHandler _linkgraph_chunk_handlers[] |
{ { 'LGRP', Save_LGRP, Load_LGRP, NULL, NULL, CH_LAST}, }
const SaveLoad _node_desc[] [static] |
{ SLE_CONDVAR(Node, supply, SLE_UINT32, SL_COMPONENTS, SL_MAX_VERSION), SLE_CONDVAR(Node, demand, SLE_UINT32, SL_COMPONENTS, SL_MAX_VERSION), SLE_CONDVAR(Node, station, SLE_UINT16, SL_COMPONENTS, SL_MAX_VERSION), }
SaveLoad desc for a link graph node.
Definition at line 76 of file linkgraph_sl.cpp.