From b51795aa8e60d1f418c071e30e2f38a93ce692cb Mon Sep 17 00:00:00 2001 From: Alex Foster <123afoster@gmail.com> Date: Sun, 27 Aug 2023 10:02:34 -0800 Subject: [PATCH] use cube array semantics --- game/edit.cpp | 19 +++++++++---------- game/render.cpp | 4 ++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/game/edit.cpp b/game/edit.cpp index 35c4557e..5348b480 100644 --- a/game/edit.cpp +++ b/game/edit.cpp @@ -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); } } } @@ -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(); @@ -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); } } } @@ -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); } } } diff --git a/game/render.cpp b/game/render.cpp index 62767269..409cedfa 100644 --- a/game/render.cpp +++ b/game/render.cpp @@ -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; @@ -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;