优化极简检测代码
This commit is contained in:
@@ -1053,33 +1053,27 @@ do--Player.drop(P)--Place piece
|
|||||||
|
|
||||||
--Finesse: roof check
|
--Finesse: roof check
|
||||||
local finesse
|
local finesse
|
||||||
if CY<=18 then
|
if CY>ENV.fieldH-2 then
|
||||||
local y0=CY
|
finesse=true
|
||||||
|
else
|
||||||
for x=1,#CB[1]do
|
for x=1,#CB[1]do
|
||||||
local y
|
local y=#CB
|
||||||
for i=#CB,1,-1 do
|
|
||||||
if CB[i][x]then
|
--Find the highest y of blocks' x-th column
|
||||||
y=i
|
while not CB[y][x]do y=y-1 end
|
||||||
goto L1
|
|
||||||
end
|
local testX=CX+x-1--Optimize
|
||||||
end
|
|
||||||
goto L2
|
--Test the whole column of field to find roof
|
||||||
::L1::
|
for testY=CY+y,#P.field do
|
||||||
if y then
|
if P:solid(testX,testY)then
|
||||||
x=CX+x-1
|
finesse=true
|
||||||
for y1=y0+y,#P.field do
|
goto BERAK
|
||||||
--Roof=finesse
|
|
||||||
if P:solid(x,y1)then
|
|
||||||
finesse=true
|
|
||||||
goto L2
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
::BERAK::
|
||||||
finesse=true
|
|
||||||
end
|
end
|
||||||
::L2::
|
|
||||||
|
|
||||||
--Remove rows need to be cleared
|
--Remove rows need to be cleared
|
||||||
if cc>0 then
|
if cc>0 then
|
||||||
|
|||||||
Reference in New Issue
Block a user