diff options
author | Michael Lutz <michi@icosahedron.de> | 2019-04-14 16:28:08 +0200 |
---|---|---|
committer | Charles Pigott <charlespigott@googlemail.com> | 2019-04-15 22:52:50 +0100 |
commit | 4e85ccf3c049cb508873bb8320f770c328e76513 (patch) | |
tree | 9e1e144e2f77f5c31a3bd32f19158e8db4e0b2b2 /src/saveload/oldloader_sl.cpp | |
parent | 79343762a4ec02cc78efcec4b38b8ffda4910772 (diff) | |
download | openttd-4e85ccf3c049cb508873bb8320f770c328e76513.tar.xz |
Codechange: Replace SmallStackSafeStackAlloc with std::array.
The only port that ever used it to make heap allocations instead of stack ones was the NDS port, which got thrown out some time ago.
Diffstat (limited to 'src/saveload/oldloader_sl.cpp')
-rw-r--r-- | src/saveload/oldloader_sl.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index 663934103..1590cb655 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -31,6 +31,7 @@ #include "../core/smallvec_type.hpp" #include "saveload_internal.h" #include "oldloader.h" +#include <array> #include "table/strings.h" #include "../table/engines.h" @@ -1754,8 +1755,8 @@ bool LoadTTDMain(LoadgameState *ls) _read_ttdpatch_flags = false; /* Load the biggest chunk */ - SmallStackSafeStackAlloc<byte, OLD_MAP_SIZE * 2> map3; - _old_map3 = map3.data; + std::array<byte, OLD_MAP_SIZE * 2> map3; + _old_map3 = map3.data(); _old_vehicle_names = nullptr; try { if (!LoadChunk(ls, nullptr, main_chunk)) { @@ -1797,10 +1798,10 @@ bool LoadTTOMain(LoadgameState *ls) _read_ttdpatch_flags = false; - SmallStackSafeStackAlloc<byte, 103 * sizeof(Engine)> engines; // we don't want to call Engine constructor here - _old_engines = (Engine *)engines.data; - SmallStackSafeStackAlloc<StringID, 800> vehnames; - _old_vehicle_names = vehnames.data; + std::array<byte, 103 * sizeof(Engine)> engines; // we don't want to call Engine constructor here + _old_engines = (Engine *)engines.data(); + std::array<StringID, 800> vehnames; + _old_vehicle_names = vehnames.data(); /* Load the biggest chunk */ if (!LoadChunk(ls, nullptr, main_chunk)) { |