07-02-2005, 03:36 AM
This seems to work (in theory :???, Torahteen.
You would basically add this to your FindPath SUB (to save time, you could use nested FOR...NEXT loops as shown below):
Then, you would modify your code to get the value of "ignoreNode", before calculating F, G and H scores, and using EXIT IF if it is set to True. Reset it before moving to the next node/square (probably right before your NEXT x).
That seems like it would work, but I'm not 100% positive!
Edit: Good job, dumbledore. Much better!
Edit (again): dumbledore, why did you include the C runtime prototypes? You didn't do it in your previous code. . .
Edit (yet again): The "Mod" in xMod and yMod means "modifier".
You would basically add this to your FindPath SUB (to save time, you could use nested FOR...NEXT loops as shown below):
Code:
IF (IsOnOpen((c.x + x),(c.y + y))) = False THEN
FOR yMod = -1 TO 1
FOR xMod = -1 TO 1
IF map((c.x + x + xMod), (c.y + y + yMod)).mType = Wall THEN
ignoreNode = True: EXIT FOR
END IF
NEXT xMod
IF ignoreNode = True THEN EXIT FOR
NEXT yMod
'Calculate F, G, and H scores
'G First
Then, you would modify your code to get the value of "ignoreNode", before calculating F, G and H scores, and using EXIT IF if it is set to True. Reset it before moving to the next node/square (probably right before your NEXT x).
That seems like it would work, but I'm not 100% positive!
Edit: Good job, dumbledore. Much better!
Edit (again): dumbledore, why did you include the C runtime prototypes? You didn't do it in your previous code. . .
Edit (yet again): The "Mod" in xMod and yMod means "modifier".
974277320612072617420666C61696C21 (Hexadecimal for those who don't know)