# Issue with c++ recursive method

Hi all,
I am continuing with Blindcraft development, adding more and more featuures every day. Yesterday I planned to increase interactivity of the game and make it ready for some first animals and mobs, hovever I encountered a strange problem, which I can not solve.

My plan was to able player to delete zone, in which he stands currently. So I wrote simple recursive function, which should to do it. It looks as follows:

void zone_delete(std::string searched_zone, int x, int y, int z)
{
world[x][y][z].zone="";
if (y+1<200) {if (world[x][y+1][z].zone==searched_zone) zone_delete(searched_zone, x, y+1, z);}
if (x+1<200) {if (world[x+1][y][z].zone==searched_zone) zone_delete(searched_zone, x+1, y, z);}
if (y-1>0) {if (world[x][y-1][z].zone==searched_zone) zone_delete(searched_zone, x, y-1, z);}
if (x-1>0) {if (world[x-1][y][z].zone==searched_zone) zone_delete(searched_zone, x-1, y, z);}
if (z+1<200) {if (world[ x][y][z+1].zone==searched_zone) zone_delete(searched_zone, x, y, z+1);}
if (z-1>=0) {if (world[x][y][z-1].zone==searched_zone) zone_delete(searched_zone, x, y, z-1);}
}

I think code is selfcommenting, it is very easy function. I tested it hovever and gave this results:
Deletion of me created zone was done succesfully, algorithm removed it reliably, hooray!
Deletion of biom zone was successful too, for better imagination forest size is 100*100, and three blocks above the ground are always zoned as forest, this all was successfully removed, hooray!
And finally, deletion of cutted tree zone, hem, application crashed, wtf?
Really, I stand in a tree zone, pressed ctrl+r and program crashed, when removing zone of a normal tree. And this is happening again and again, nowhere else, just when removing tree zone, it does have problems. I can not understand it. Only explanation I do have is, that some limit of recursive calls was passed, hovever why, when removing of whole biom zone did not made problems? Is there something like recursive limit, so this theory is possible? I really haven't imagination how many blocks of trees are zoned, one tree is about 12 blocks tall and about 7 wide, zone is allways used to distance of two blocks from object, hovever trees are relatively near themselves, so zones of few trees can be joined to one large, or it can be also from few tens of trees, it depends how thicky is forest generated.

Hovever, that is not important, if there is zone from more trees, algorithm should to delete it full, not crash the application. Does someone have explanation for this please?

Thank you in advance.

Best regards

Rastislav

P.S. Luckyly I backed up a copy of full message, ag has shredded it successfully.

```_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector