| 06-12-2006, 05:30 PM | #1 | |
JASS:function ImALoop takes nothing returns nothing ...Declaration stuff that I know is correct... loop exitwhen index1 > 250 loop exitwhen index2 > 360 set x = tgtx + index1 * Cos(0.017453*index2) set y = tgty + index1 * Sin(0.017453*index2) if not IsPointBlighted(x, y) then set factorcount = factorcount + 1 endif if index2>357 then call BJDebugMsg("Index 2: " + I2S(index2)) endif set index2 = index2 + 1 endloop set index2 = 1 call BJDebugMsg("Index 1: " + I2S(index1)) set index1 = index1 + 1 endloop call BJDebugMsg("Count: " + I2S(factorcount)) endfunction What it does is check circles around a target point to see if they are blighted or not, and creates a 'count' of the total unblighted points it encounters. My problem is that in running, it only makes it to when index1 == 11 and then returns and the ENTIRE rest of the function after this series of loops is ignored. My initial guess was that the WC engine thought it was an infinite loop and broke it and exited, but I really don't know. I realize the loop runs A LOT of times, but it's sort of necessary to do what I'm doing professionally. I was thinking of incrementing index1 and index2 by 2 instead of 1 to see if that changed anything, but any additional idea of what's going on would be nice. Thanks in advance. Quote:
|
| 06-12-2006, 05:42 PM | #2 | |
Indeed. I measured a few of the ops contributions to that limit, data is here http://www.wc3jass.com/viewtopic.php?t=2747. You might be able to make a stab at calculating the optimal interval, of course you could just measure. Quote:
|
| 06-12-2006, 06:13 PM | #3 |
Doesn't blight apply to individual terrain squares anyway? (That would mean that only each 128 x 128 square would need to be checked) |
| 06-12-2006, 06:15 PM | #4 |
Well I'll post more of the function in the future, but there are 200 lines to it that really don't contribute to the loop at all. :P And I suppose I could try to find out just what that upper limit is; I'll try to work it through in a bit though, I just want this spell working for now. Is that true, Blu? I've never really played with blight before so I wasn't sure the method to manipulating it. I suppose blight does work over a 128x128 square upon further inspection, so perhaps a higher increment isn't too out of the ordinary. |
