Skip to content

Commit

Permalink
use cube array semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Aug 27, 2023
1 parent 0117510 commit b51795a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
19 changes: 9 additions & 10 deletions game/edit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ void replacetexcube(cube &c, int oldtex, int newtex)
{
for(int i = 0; i < 8; ++i)
{
replacetexcube(c.children[i], oldtex, newtex);
replacetexcube((*c.children)[i], oldtex, newtex);
}
}
}
Expand All @@ -976,7 +976,7 @@ void mpreplacetex(int oldtex, int newtex, bool insel, selinfo &sel, bool local)
{
for(int i = 0; i < 8; ++i)
{
replacetexcube(rootworld.worldroot[i], oldtex, newtex);
replacetexcube((*rootworld.worldroot)[i], oldtex, newtex);
}
}
rootworld.allchanged();
Expand Down Expand Up @@ -1060,7 +1060,7 @@ void flipcube(cube &c, int d)
}
for(int i = 0; i < 8; ++i)
{
flipcube(c.children[i], d);
flipcube((*c.children)[i], d);
}
}
}
Expand Down Expand Up @@ -1100,17 +1100,16 @@ void rotatecube(cube &c, int d)
{
int row = octadim(R[d]);
int col = octadim(C[d]);
for(int i=0; i<=octadim(d); i+=octadim(d)) rotatequad
(
c.children[i+row],
c.children[i],
c.children[i+col],
c.children[i+col+row]
for(int i=0; i<=octadim(d); i+=octadim(d))
rotatequad ((*c.children)[i+row],
(*c.children)[i],
(*c.children)[i+col],
(*c.children)[i+col+row]
);
//recursively apply to children
for(int i = 0; i < 8; ++i)
{
rotatecube(c.children[i], d);
rotatecube((*c.children)[i], d);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions game/render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ namespace game
sel.corner = (cor[R[d]]-(lu[R[d]]*2)/gridsize)+(cor[C[d]]-(lu[C[d]]*2)/gridsize)*2;
selchildcount = 0;
selchildmat = -1;
countselchild(rootworld.worldroot, ivec(0, 0, 0), rootworld.mapsize()/2);
countselchild(*rootworld.worldroot, ivec(0, 0, 0), rootworld.mapsize()/2);
if(mag>=1 && selchildcount==1)
{
selchildmat = c->material;
Expand Down Expand Up @@ -991,7 +991,7 @@ namespace game
sel.corner = (cor[R[d]]-(lu[R[d]]*2)/gridsize)+(cor[C[d]]-(lu[C[d]]*2)/gridsize)*2;
selchildcount = 0;
selchildmat = -1;
countselchild(rootworld.worldroot, ivec(0, 0, 0), rootworld.mapsize()/2);
countselchild(*rootworld.worldroot, ivec(0, 0, 0), rootworld.mapsize()/2);
if(mag>=1 && selchildcount==1)
{
selchildmat = c->material;
Expand Down

0 comments on commit b51795a

Please sign in to comment.