Hiya all. Im doing some heavy work with pseudo-multi-dimensional arrays at the moment.
I have done a LOT of coding with it as actual multi-dimensional array,
but its just getting to tricky down in the guts, and the code LOOKS ugly,
because of all the bracketing required around them...
(ie (slabs[x])[y].element = xxx; )
Therefore Ive decided to simplify and go for a single-dimension array that I reference
AS IF it was multi-dimensional.
(ie slabs[x+y*width].element = xxx; )
This re-codeing of pages and pages of script is what Im working on now...
BUT, Im looking for a 'shortcut' with the referencing, to try to tidy my code.
Ive tryed a few variations of THIS
SLAB** slabs = (SLAB**)sys_malloc(sizeof(SLAB*)*???);
SLAB* slab(int x, int y) { return(slabs[x+y*slab_len]); }
//attempted usage
slab(x,y).LOD = 123; and/or xyz = slab(x,y).LOD;
//which is to replace
slabs[x+y*slab_len].LOD = 123; and/or xyz = slabs[x+y*slab_len].LOD;
//which in the process of replacing
(slabs[x])[y].LOD = 123; and/or xyz = (slabs[x])[y].LOD;
So can you see what I want? Have I explained this properly?
I am hoping someone has some ideas for a macro, function, or macro/function combo
that will let me access my array on BOTH sides of the equals sign using a simple
slab(x,y) string in my scripts...
Thanks Guys