diff options
author | glx <glx@openttd.org> | 2019-12-16 19:28:46 +0100 |
---|---|---|
committer | Niels Martin Hansen <nielsm@indvikleren.dk> | 2019-12-21 20:13:03 +0100 |
commit | 09fa39c5b59d88a076a244cf1623a53b0ffa1434 (patch) | |
tree | c4b7006085df37a7c0b5f5a5bb3e62bcc53cae42 /src/saveload | |
parent | 00c2a98cf395d6e2a85290048e7be7a7f6ce0d04 (diff) | |
download | openttd-09fa39c5b59d88a076a244cf1623a53b0ffa1434.tar.xz |
Codechange: Replace linkgraph related FOR_ALL with range-based for loops
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/linkgraph_sl.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/saveload/linkgraph_sl.cpp b/src/saveload/linkgraph_sl.cpp index 608630b83..29b685cf7 100644 --- a/src/saveload/linkgraph_sl.cpp +++ b/src/saveload/linkgraph_sl.cpp @@ -228,17 +228,15 @@ static void Load_LGRS() void AfterLoadLinkGraphs() { if (IsSavegameVersionBefore(SLV_191)) { - LinkGraph *lg; - FOR_ALL_LINK_GRAPHS(lg) { + for (LinkGraph *lg : LinkGraph::Iterate()) { for (NodeID node_id = 0; node_id < lg->Size(); ++node_id) { const Station *st = Station::GetIfValid((*lg)[node_id].Station()); if (st != nullptr) (*lg)[node_id].UpdateLocation(st->xy); } } - LinkGraphJob *lgj; - FOR_ALL_LINK_GRAPH_JOBS(lgj) { - lg = &(const_cast<LinkGraph &>(lgj->Graph())); + for (LinkGraphJob *lgj : LinkGraphJob::Iterate()) { + LinkGraph *lg = &(const_cast<LinkGraph &>(lgj->Graph())); for (NodeID node_id = 0; node_id < lg->Size(); ++node_id) { const Station *st = Station::GetIfValid((*lg)[node_id].Station()); if (st != nullptr) (*lg)[node_id].UpdateLocation(st->xy); @@ -254,8 +252,7 @@ void AfterLoadLinkGraphs() */ static void Save_LGRP() { - LinkGraph *lg; - FOR_ALL_LINK_GRAPHS(lg) { + for (LinkGraph *lg : LinkGraph::Iterate()) { SlSetArrayIndex(lg->index); SlAutolength((AutolengthProc*)DoSave_LGRP, lg); } @@ -266,8 +263,7 @@ static void Save_LGRP() */ static void Save_LGRJ() { - LinkGraphJob *lgj; - FOR_ALL_LINK_GRAPH_JOBS(lgj) { + for (LinkGraphJob *lgj : LinkGraphJob::Iterate()) { SlSetArrayIndex(lgj->index); SlAutolength((AutolengthProc*)DoSave_LGRJ, lgj); } |