mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-10 11:51:52 +00:00
SAGA2: Create destructors for MapHeader and MetaTileList
This commit is contained in:
parent
f930e14188
commit
ed2fe2befc
@ -1442,6 +1442,11 @@ MapHeader::MapHeader(Common::SeekableReadStream *stream) {
|
||||
mapData[i] = stream->readUint16LE();
|
||||
}
|
||||
|
||||
MapHeader::~MapHeader() {
|
||||
if (mapData)
|
||||
delete[] mapData;
|
||||
}
|
||||
|
||||
MetaTile::MetaTile(int ind, Common::SeekableReadStream *stream) {
|
||||
_index = ind;
|
||||
_highestPixel = stream->readUint16LE();
|
||||
@ -1462,6 +1467,17 @@ MetaTileList::MetaTileList(int count, Common::SeekableReadStream *stream) {
|
||||
}
|
||||
}
|
||||
|
||||
MetaTileList::~MetaTileList() {
|
||||
if (_tiles) {
|
||||
for (int i = 0; i < _count; ++i) {
|
||||
if (_tiles[i])
|
||||
delete _tiles[i];
|
||||
}
|
||||
|
||||
free(_tiles);
|
||||
}
|
||||
}
|
||||
|
||||
static void readActiveItem(hResContext *con, ActiveItem &itm) {
|
||||
// FIXME: 32-bit pointer to 64-bit pointer conversion.
|
||||
// Is this dangerous?
|
||||
@ -1627,23 +1643,12 @@ void cleanupMaps(void) {
|
||||
WorldMapData *mapData = &mapList[i];
|
||||
|
||||
// Dump the map
|
||||
if (mapData->map != nullptr) {
|
||||
if (mapData->map->mapData != nullptr)
|
||||
delete[] mapData->map->mapData;
|
||||
|
||||
if (mapData->map != nullptr)
|
||||
delete mapData->map;
|
||||
mapData->map = nullptr;
|
||||
}
|
||||
|
||||
// Dump the meta tile list
|
||||
if (mapData->metaList) {
|
||||
for (int k = 0; k < mapData->metaList->_count; ++i)
|
||||
if (mapData->metaList->_tiles[i])
|
||||
delete mapData->metaList->_tiles[i];
|
||||
|
||||
free(mapData->metaList->_tiles);
|
||||
}
|
||||
delete mapData->metaList;
|
||||
if (mapData->metaList)
|
||||
delete mapData->metaList;
|
||||
|
||||
// If there is active item data, dump it
|
||||
if (mapData->activeItemData != nullptr)
|
||||
|
@ -825,6 +825,7 @@ public:
|
||||
MetaTile **_tiles;
|
||||
|
||||
MetaTileList(int count, Common::SeekableReadStream *stream);
|
||||
~MetaTileList();
|
||||
};
|
||||
|
||||
/* ===================================================================== *
|
||||
@ -837,6 +838,7 @@ struct MapHeader {
|
||||
uint16 *mapData; // start of map array
|
||||
|
||||
MapHeader(Common::SeekableReadStream *stream);
|
||||
~MapHeader();
|
||||
};
|
||||
|
||||
enum mapEdgeTypes {
|
||||
|
Loading…
Reference in New Issue
Block a user