Variable Size Multi Dimensional Array Casting?
Hi all.
This is my first post so before I start begging for help let me first say that I am very grateful to the people who contribute and created this site. It has been invaluable to me for quick and easy reference. So thank you, hugely.
Now to my "problem". I am working with a game engine library, and for the most part everything is great. I just have a small issue that I would ideally like to fix. The library does many things, one of which is supply Game Map data.
int s_x, int s_y;
char* mapData=(char*)MapData(s_x,s_y);
s_x and s_y are output vars which receive the dimensions of the 2D map (W x H), each map element is comprised of 8 bytes, s_x of these form 1 row and s_y rows form the entire data block.
At the moment I can access byte (n) of the element at a particular row (y) and column (x) like this:
mapData[ (s_x*y*8) + (x*8) + n ]
What would be very useful to me is if I could access an element like this:
mapData[y][x][n]
So far I have not been able to find any information on casting the pointer to a multidimsional array type. I can do it if the map size is always the same using a typedef but I cannot work out or find out how to cast to variable sizes or if it's even possible.
Many thanks for any help.
Alain.