(Simple?) List problem?

BlitzMax Forums/BlitzMax Beginners Area/(Simple?) List problem?

Ant(Posted 2006) [#1]
Hi, I'm wondering if someone can takea look at this snippet of code. Its basically a search which is based upon a object passed to it. The search will basically keep searching out from its passed object until it doesnt find any other objects of the same colour and then it returns the list its created. The actual search works well, but the problem I am having is that this line:

returnedGem.time = priority

Rather than take the value of 'priority' which is incremented each time the main loop is executed, each gem in the returned list always has a priority value of 3 - which is the number of times the 'returnedGem.Time = priority ' line is executed when this code is executed. I just dont understand it - the list of objects that it creates is perfectly fine and contains all the objects it should, so why does the priority variable for all the objects = 3
Thanks




Eric(Posted 2006) [#2]
I would guess because Priority is local to the FloodFillSearch method and is being reset everytime that method is called.


Ant(Posted 2006) [#3]
got ya ;-)
Cheers