Only load and unload normal tile layer data if necessary

This commit is contained in:
Robert Müller 2022-08-14 12:38:08 +02:00
parent 8828838f68
commit 45a20ff277

View file

@ -677,7 +677,6 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
pLayer = pTiles;
pGroup->AddLayer(pTiles);
void *pData = DataFile.GetData(pTilemapItem->m_Data);
pTiles->m_Image = pTilemapItem->m_Image;
pTiles->m_Game = pTilemapItem->m_Flags & TILESLAYERFLAG_GAME;
@ -814,6 +813,7 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
}
else // regular tile layer or game layer
{
void *pData = DataFile.GetData(pTilemapItem->m_Data);
unsigned int Size = DataFile.GetDataSize(pTilemapItem->m_Data);
if(Size >= (size_t)pTiles->m_Width * pTiles->m_Height * sizeof(CTile))
{
@ -828,9 +828,8 @@ int CEditorMap::Load(class IStorage *pStorage, const char *pFileName, int Storag
}
}
}
DataFile.UnloadData(pTilemapItem->m_Data);
}
DataFile.UnloadData(pTilemapItem->m_Data);
}
else if(pLayerItem->m_Type == LAYERTYPE_QUADS)
{