From f53db020f5b0cd6b83c9f7c182a3b2036f4323c7 Mon Sep 17 00:00:00 2001 From: devinacker Date: Mon, 1 Jun 2015 20:12:22 -0400 Subject: [PATCH] use heap alloc for temp playfields to try to alleviate memory access issues on OS X --- src/level.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/level.cpp b/src/level.cpp index 3d1b62d..ebc3572 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -239,7 +239,8 @@ QList saveLevel(leveldata_t *level, int *fieldSize) { chunks.append(new QByteArray((const char*)packed, packedSize)); // step 6: create packed playfield tilemaps and write them - uint16_t playfield[2][MAX_FIELD_HEIGHT][MAX_FIELD_WIDTH]; + auto playfield = new uint16_t[2][MAX_FIELD_HEIGHT][MAX_FIELD_WIDTH]; + makeIsometricMap(playfield, level); uint16_t rowStarts [CHUNK_SIZE / 2] = {0}; @@ -287,6 +288,8 @@ QList saveLevel(leveldata_t *level, int *fieldSize) { index += rowLen; } + delete[] playfield; + if (fieldSize) { *fieldSize = index * 2; }