干掉所有的goto来测试love.js
This commit is contained in:
@@ -127,8 +127,9 @@ local function checkLink(x1,y1,x2,y2)
|
||||
while ruy>1 and not field[ruy-1][x2] do ruy=ruy-1 end
|
||||
while rdy<field.r and not field[rdy+1][x2] do rdy=rdy+1 end
|
||||
for y=max(luy,ruy),min(ldy,rdy) do
|
||||
for x=x1+1,x2-1 do if field[y][x] then goto CONTINUE_nextRow end end
|
||||
do
|
||||
local nextLine
|
||||
for x=x1+1,x2-1 do if field[y][x] then nextLine=true break end end-- goto CONTINUE_nextRow
|
||||
if not nextLine then
|
||||
local len=abs(x1-x2)+abs(y-y1)+abs(y-y2)
|
||||
if len<bestLen then
|
||||
bestLen=len
|
||||
@@ -138,7 +139,7 @@ local function checkLink(x1,y1,x2,y2)
|
||||
addPoint(bestLine,x2,y2)
|
||||
end
|
||||
end
|
||||
::CONTINUE_nextRow::
|
||||
-- ::CONTINUE_nextRow::
|
||||
end
|
||||
end
|
||||
-- X-Y-X Check
|
||||
@@ -150,8 +151,9 @@ local function checkLink(x1,y1,x2,y2)
|
||||
while dlx>1 and not field[y2][dlx-1] do dlx=dlx-1 end
|
||||
while drx<field.c and not field[y2][drx+1] do drx=drx+1 end
|
||||
for x=max(ulx,dlx),min(urx,drx) do
|
||||
for y=y1+1,y2-1 do if field[y][x] then goto CONTINUE_nextCol end end
|
||||
do
|
||||
local nextLine
|
||||
for y=y1+1,y2-1 do if field[y][x] then nextLine=true break end end-- goto CONTINUE_nextCol
|
||||
if not nextLine then
|
||||
local len=abs(y1-y2)+abs(x-x1)+abs(x-x2)
|
||||
if len<bestLen then
|
||||
bestLen=len
|
||||
@@ -161,7 +163,7 @@ local function checkLink(x1,y1,x2,y2)
|
||||
addPoint(bestLine,x2,y2)
|
||||
end
|
||||
end
|
||||
::CONTINUE_nextCol::
|
||||
-- ::CONTINUE_nextCol::
|
||||
end
|
||||
end
|
||||
return bestLine
|
||||
|
||||
Reference in New Issue
Block a user