So I have this 'world' class with a lot of iterating over world data in different methods and I wonder if it's possible to wrap this around in such manner:
Code:
for block in wordData do begin
instead of:
Code:
for z:=0 to world_depth-1 do begin
for x:=0 to world_width-1 do
for y:=0 to chunk_height-1 do begin
chx:=x div chunk_width;
chy:=z div chunk_width;
xx:=x mod chunk_width;
yy:=y;
zz:=z mod chunk_width;
pBlok:=@chunksPointer^[chx,chy].blocks[xx,yy,zz];
...
end;
end;
in each method.
I suppose that it would be more obvious if 'wordData' was a list but I'm storing data in an array of 'chunk' class and each chunk stores blocks in 3d array.
is there a way to do that?
Bookmarks