From d98c0c605cf1495e0857d533adb2979e2270c808 Mon Sep 17 00:00:00 2001 From: scawful Date: Thu, 23 Jun 2022 11:07:36 -0400 Subject: [PATCH] unique ptr memory management --- src/app/zelda3/overworld.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/app/zelda3/overworld.cc b/src/app/zelda3/overworld.cc index 6f6e7df8..8f542b79 100644 --- a/src/app/zelda3/overworld.cc +++ b/src/app/zelda3/overworld.cc @@ -113,9 +113,9 @@ void Overworld::DecompressAllMapTiles() { << 8) + (rom_.data()[(constants::compressedAllMap32PointersHigh + (3 * i))]); - auto* tmp = new char[256]; + auto tmp2 = std::make_unique(256); + auto tmp = tmp2.get(); p1 = lorom_snes_to_pc(p1, &tmp); - std::cout << tmp << std::endl; int p2 = (rom_.data()[(constants::compressedAllMap32PointersLow) + 2 + (3 * i)] << 16) + @@ -123,8 +123,6 @@ void Overworld::DecompressAllMapTiles() { << 8) + (rom_.data()[(constants::compressedAllMap32PointersLow + (3 * i))]); p2 = lorom_snes_to_pc(p2, &tmp); - std::cout << tmp << std::endl; - delete[] tmp; int ttpos = 0; unsigned int compressedSize1 = 0; @@ -153,7 +151,7 @@ void Overworld::DecompressAllMapTiles() { for (int y = 0; y < 16; y++) { for (int x = 0; x < 16; x++) { - ushort tidD = (ushort)((bytes2[ttpos] << 8) + bytes[ttpos]); + auto tidD = (ushort)((bytes2[ttpos] << 8) + bytes[ttpos]); int tpos = tidD; if (tpos < tiles32.size()) {