aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb/gfx.cpp
diff options
context:
space:
mode:
authorNipun Garg2019-07-18 19:08:59 +0530
committerEugene Sandulenko2019-09-03 17:17:23 +0200
commit05cb55b8883fdf4f6a44f285d29716d2d17da9c2 (patch)
tree4c6cdf2cf2524e9fb28beb5449edc4ccc2b1059e /engines/hdb/gfx.cpp
parentfd91bb7f59ba6ac1b3be7bc245bc25042a05a464 (diff)
downloadscummvm-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.cpp12
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;