Change malloc/free -> new/delete in Tgl

This commit is contained in:
Mark Langen 2023-11-30 21:23:36 -08:00
parent c2bb95b210
commit fab0d80e36
2 changed files with 5 additions and 5 deletions

View File

@ -11,7 +11,7 @@ DECOMP_SIZE_ASSERT(MeshImpl, 0x8);
MeshImpl::~MeshImpl() MeshImpl::~MeshImpl()
{ {
if (m_data) { if (m_data) {
free(m_data); delete m_data;
m_data = NULL; m_data = NULL;
} }
} }

View File

@ -81,9 +81,9 @@ TglD3DRMIMAGE::TglD3DRMIMAGE(
void TglD3DRMIMAGE::Destroy() void TglD3DRMIMAGE::Destroy()
{ {
if (m_texelsAllocatedByClient == 0) { if (m_texelsAllocatedByClient == 0) {
free(m_image.buffer1); delete m_image.buffer1;
} }
free(m_image.palette); delete m_image.palette;
} }
// OFFSET: LEGO1 0x100a13e0 STUB // OFFSET: LEGO1 0x100a13e0 STUB
@ -106,12 +106,12 @@ Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries)
// into into the TglD3DRMIMAGE class instead of being a global struct. // into into the TglD3DRMIMAGE class instead of being a global struct.
if (m_image.palette_size != paletteSize) { if (m_image.palette_size != paletteSize) {
if (m_image.palette != NULL) { if (m_image.palette != NULL) {
free(m_image.palette); delete m_image.palette;
m_image.palette = NULL; m_image.palette = NULL;
m_image.palette_size = 0; m_image.palette_size = 0;
} }
if (paletteSize > 0) { if (paletteSize > 0) {
m_image.palette = (D3DRMPALETTEENTRY*) malloc(4 * paletteSize); m_image.palette = new D3DRMPALETTEENTRY[paletteSize];
m_image.palette_size = paletteSize; m_image.palette_size = paletteSize;
} }
} }