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.
This commit is contained in:
Michael Lutz
2019-04-14 16:28:08 +02:00
committed by Charles Pigott
parent 79343762a4
commit 4e85ccf3c0
3 changed files with 49 additions and 90 deletions

View File

@@ -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)) {