* Spawn the threads for running link graph calculations. * Has to be done after loading as the cargo classes might have changed. */
| 230 | * Has to be done after loading as the cargo classes might have changed. |
| 231 | */ |
| 232 | void AfterLoadLinkGraphs() |
| 233 | { |
| 234 | if (IsSavegameVersionBefore(SLV_191)) { |
| 235 | for (LinkGraph *lg : LinkGraph::Iterate()) { |
| 236 | for (NodeID node_id = 0; node_id < lg->Size(); ++node_id) { |
| 237 | const Station *st = Station::GetIfValid((*lg)[node_id].station); |
| 238 | if (st != nullptr) (*lg)[node_id].UpdateLocation(st->xy); |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | for (LinkGraphJob *lgj : LinkGraphJob::Iterate()) { |
| 243 | LinkGraph *lg = &(const_cast<LinkGraph &>(lgj->Graph())); |
| 244 | for (NodeID node_id = 0; node_id < lg->Size(); ++node_id) { |
| 245 | const Station *st = Station::GetIfValid((*lg)[node_id].station); |
| 246 | if (st != nullptr) (*lg)[node_id].UpdateLocation(st->xy); |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | LinkGraphSchedule::instance.SpawnAll(); |
| 252 | |
| 253 | if (!_networking || _network_server) { |
| 254 | AfterLoad_LinkGraphPauseControl(); |
| 255 | } |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * All link graphs. |
no test coverage detected