ppTile = new Tile*[tileN];
for(int x=0; x<tileN; x++)
{
ppTile[x] = new Tile(Tile::TileType(pCData->GetdefaultTile()),
((x*2)+1) % (mapSize+(mapSize-1)),
( x/ ((float)mapSize-0.5) )+1,
pCData->GetdefaultHeight()
);
}
How will I delete both the array of Tile* and the Tile objects?
Edit: This is my guess:
Map::~Map()
{
if(ppTile)
{
for(int x=0; x<mapSize*(mapSize-1); x++)
{
delete ppTile[x];
}
delete[] ppTile;
}
}
Is that right?