Hi.
I encountered a problem, where i need to get size of 3D array, because i will use size of this to "SetLength" of other dynamic array (1D).
What i have is this:
Code:
myarray[0..255, 0..255, 0..7] of tmyRecord;
dynarray: array of tmyObject;
3D array is used to render 3D map. Because i render only specific range (not whole map at once), the X, Y ranges may vary. They could be for ex: X: 17 - 24, Y: 0 - 7.
Z is always max 7.
Because of that i must sum them up: X * Y * Z. I get some value.
And then i set the length of dynamic array to this sum.
I mean
Code:
sum:= X * Y * Z;
SetLength(dynarray, sum);
But is it safe and correct way to do?
What i need is the SUM of NR_OF_OBJECTS within specified X,Y,Z range.
Should i be aware of something? Crashes, leaks?
Im just not sure if im doing it correctly.
Thanks for any help.
Bookmarks