diff options
author | Nipun Garg | 2019-07-18 19:08:59 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:23 +0200 |
commit | 05cb55b8883fdf4f6a44f285d29716d2d17da9c2 (patch) | |
tree | 4c6cdf2cf2524e9fb28beb5449edc4ccc2b1059e /engines/hdb/gfx.cpp | |
parent | fd91bb7f59ba6ac1b3be7bc245bc25042a05a464 (diff) | |
download | scummvm-rg350-05cb55b8883fdf4f6a44f285d29716d2d17da9c2.tar.gz scummvm-rg350-05cb55b8883fdf4f6a44f285d29716d2d17da9c2.tar.bz2 scummvm-rg350-05cb55b8883fdf4f6a44f285d29716d2d17da9c2.zip |
HDB: Delete Cached gfx data in one place
Diffstat (limited to 'engines/hdb/gfx.cpp')
-rw-r--r-- | engines/hdb/gfx.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/engines/hdb/gfx.cpp b/engines/hdb/gfx.cpp index 94c46bddf8..94ba77b604 100644 --- a/engines/hdb/gfx.cpp +++ b/engines/hdb/gfx.cpp @@ -42,8 +42,14 @@ Gfx::Gfx() { } Gfx::~Gfx() { - for (uint i = 0; i < _gfxCache->size(); i++) - delete _gfxCache->operator[](i); + for (uint i = 0; i < _gfxCache->size(); i++) { + GfxCache *cache = _gfxCache->operator[](i); + if (cache->status) + delete cache->picGfx; + else + delete cache->tileGfx; + delete cache; + } delete _gfxCache; for (uint i = 0; i < _charInfoBlocks.size(); i++) delete _charInfoBlocks[i]; @@ -544,6 +550,7 @@ Tile *Gfx::getTileGfx(const char *name, int32 size) { delete stream; gc->tileGfx = gfxTile; + gc->status = false; if (size == -1) size = g_hdb->_fileMan->getLength(name, TYPE_TILE32); gc->size = size; @@ -584,6 +591,7 @@ Picture *Gfx::getPicGfx(const char *name, int32 size) { delete stream; gc->picGfx = gfxPic; + gc->status = true; if (size == -1) size = g_hdb->_fileMan->getLength(name, TYPE_PIC); gc->size = size; |