i'm not such familiar with lambda expresion. Is there any chances to call reflexie in lbd and lbd in reflexie? I get the error in reflexie: 'lbd is not captured' Thank you in advanced
auto reflexie = [&tab,nrl,o,nrc,nro,lbd](int x, int y,int dirx,int diry) -> void {
x+=dirx;
y+=diry;
for(int k = 0; k < nro; k++)
{
tab[o[k].p.l][o[k].p.c]=o[k].t;
}
while(x>=0 && x<nrl && y>=0 && y<nrc){
if(tab[x][y]=='@' || tab[x][y] =='v' || tab[x][y] =='>' || tab[x][y] =='<' || tab[x][y] =='^'||tab[x][y] =='X'||tab[x][y] =='*') break;
if(tab[x][y]=='_' && tab[x-1][y-1]=='#'){lbd(x,y,-1,+1);}
tab[x][y]='#';
x+=dirx;
y+=diry;
}
};
auto lbd = [&tab,nrl,o,s,nrc,nro,reflexie](int x, int y,int dirx,int diry) -> void {
x+=dirx;
y+=diry;
int a = x;
while(x>=0 && x<nrl && y>=0 && y<nrc){
if(tab[x][y]=='@' || tab[x][y] =='v' || tab[x][y] =='>' || tab[x][y] =='<' || tab[x][y] =='^' || tab[x][y] =='X'||tab[x][y] =='*') break;
if(tab[x][y]=='_' || tab[x][y]=='|') {
if(tab[x][y]=='_' && (tab[x][y-1]=='#' || tab[x][y+1]=='#')){break;}
if(tab[x][y]=='|' && (tab[x][y-1]=='#' || tab[x][y+1]=='#')){break;}
if(tab[x][y]=='|' && tab[x+1][y-1]=='#'){reflexie(x,y,-1,-1);}
if(tab[x][y]=='_' && tab[x+1][y+1]=='#'){reflexie(x,y,+1,-1);}
break;
}
tab[x][y]='#';
x+=dirx;
y+=diry;
}
};