diff options
author | glx22 <glx@openttd.org> | 2021-06-09 16:23:35 +0200 |
---|---|---|
committer | Loïc Guilloux <glx22@users.noreply.github.com> | 2021-07-06 22:29:08 +0200 |
commit | c1a9fe6fbd736c9e3a93314b0721d8f2cb8a2052 (patch) | |
tree | 801fdadf7721c07033fff31bf4d04c3d5f6200a5 /src/saveload/saveload.cpp | |
parent | f371a5ad705e10940612475cc697091914a2c96a (diff) | |
download | openttd-c1a9fe6fbd736c9e3a93314b0721d8f2cb8a2052.tar.xz |
Codechange: Use static array of references to ChunkHandler
Diffstat (limited to 'src/saveload/saveload.cpp')
-rw-r--r-- | src/saveload/saveload.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 69bbc75b1..39941c268 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -216,7 +216,7 @@ struct SaveLoadParams { static SaveLoadParams _sl; ///< Parameters used for/at saveload. -static const std::vector<ChunkHandler> &ChunkHandlers() +static const std::vector<ChunkHandlerRef> &ChunkHandlers() { /* These define the chunks */ extern const ChunkHandlerTable _gamelog_chunk_handlers; @@ -290,7 +290,7 @@ static const std::vector<ChunkHandler> &ChunkHandlers() _persistent_storage_chunk_handlers, }; - static std::vector<ChunkHandler> _chunk_handlers; + static std::vector<ChunkHandlerRef> _chunk_handlers; if (_chunk_handlers.empty()) { for (auto &chunk_handler_table : _chunk_handler_tables) { @@ -313,7 +313,7 @@ static void SlNullPointers() * pointers from other pools. */ _sl_version = SAVEGAME_VERSION; - for (auto &ch : ChunkHandlers()) { + for (const ChunkHandler &ch : ChunkHandlers()) { if (ch.fix_pointers) { Debug(sl, 3, "Nulling pointers for {:c}{:c}{:c}{:c}", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id); ch.FixPointers(); @@ -2312,7 +2312,7 @@ static void SlSaveChunks() */ static const ChunkHandler *SlFindChunkHandler(uint32 id) { - for (auto &ch : ChunkHandlers()) if (ch.id == id) return &ch; + for (const ChunkHandler &ch : ChunkHandlers()) if (ch.id == id) return &ch; return nullptr; } @@ -2351,7 +2351,7 @@ static void SlFixPointers() { _sl.action = SLA_PTRS; - for (auto &ch : ChunkHandlers()) { + for (const ChunkHandler &ch : ChunkHandlers()) { if (ch.fix_pointers) { Debug(sl, 3, "Fixing pointers for {:c}{:c}{:c}{:c}", ch.id >> 24, ch.id >> 16, ch.id >> 8, ch.id); ch.FixPointers(); |