Cavegen: Fix possible out-of-bounds heightmap access