> tiles = new new_tile[tilesacross][tilesdown][tilelayers];
Are any of these parameters compile time constants?

Preferably two of them should be constants, but one would be better than none

Otherwise, it's as Enmeduranki wrote