- Joined
- Feb 23, 2015
- Messages
- 96
- Reaction score
- 30
- First Language
- Italian
- Primarily Uses
Hi! In one of my games I need to check an area within dynamic borders and add it to a table, I'm using a recursive method:
It works well enough until the area to check exceeds a certain value, in that case a SystemStackError is raised, I'm sure that this method is not repeated infinitely, so I'd want to increase the maximum stack value, but I don't know which class contains it, and how is the stack's constant called, can you help me?
Also, if this can be solved in another and more efficient way, without touching the stack value, please tell me how to do it. Thank you for reading
.
#--------------------------------------------------------------------------# * GET INTERNAL_TABLE#-------------------------------------------------------------------------- def internal_table(x,y)@@internal_table.push([x,y]) if !@@internal_table.include?([x-1,y]) && terr_tile?(x-1,y)internal_table(x-1,y)endif !@@internal_table.include?([x+1,y]) && terr_tile?(x+1,y)internal_table(x+1,y)endif !@@internal_table.include?([x,y+1]) && terr_tile?(x,y+1)internal_table(x,y+1)endif !@@internal_table.include?([x,y-1]) && terr_tile?(x,y-1)internal_table(x,y-1)endend
Also, if this can be solved in another and more efficient way, without touching the stack value, please tell me how to do it. Thank you for reading
Last edited by a moderator:

