行的垃圾行标签键从[11]改为garbage

This commit is contained in:
MrZ626
2020-12-13 14:48:47 +08:00
parent 5805edef0a
commit dfebbecb87
3 changed files with 18 additions and 18 deletions

View File

@@ -1,37 +1,37 @@
local FREEROW={} local FREEROW={}
local L={}--Storage local L={}--Storage
local _=0--Length local len=0--Length
function FREEROW.reset(num) function FREEROW.reset(num)
if num<_ then if num<len then
for i=_,num+1,-1 do for i=len,num+1,-1 do
L[i]=nil L[i]=nil
end end
elseif num>_ then elseif num>len then
for i=_+1,num do for i=len+1,num do
L[i]={0,0,0,0,0,0,0,0,0,0} L[i]={0,0,0,0,0,0,0,0,0,0}
end end
end end
_=num len=num
end end
function FREEROW.get(val,type)--type: nil=norm, true=garbage function FREEROW.get(val,ifGarbage)
if _==0 then if len==0 then
for i=1,10 do for i=1,10 do
L[i]={0,0,0,0,0,0,0,0,0,0} L[i]={0,0,0,0,0,0,0,0,0,0}
end end
_=_+10 len=len+10
end end
local t=L[_] local t=L[len]
for i=1,10 do t[i]=val end for i=1,10 do t[i]=val end
t[11]=type t.garbage=ifGarbage==true
L[_]=nil L[len]=nil
_=_-1 len=len-1
return t return t
end end
function FREEROW.discard(t) function FREEROW.discard(t)
_=_+1 len=len+1
L[_]=t L[len]=t
end end
function FREEROW.getCount() function FREEROW.getCount()
return _ return len
end end
return FREEROW return FREEROW

View File

@@ -46,7 +46,7 @@ local function check_LVup(P)
end end
P.field[i][P:RND(10)]=0 P.field[i][P:RND(10)]=0
end end
P.field[i][11]=true P.field[i].garbage=true
end end
P.garbageBeneath=10 P.garbageBeneath=10
for i=1,10 do for i=1,10 do

View File

@@ -988,7 +988,7 @@ do--Player.drop(P)--Place piece
if cc>0 then if cc>0 then
for i=cc,1,-1 do for i=cc,1,-1 do
_=P.clearedRow[i] _=P.clearedRow[i]
if P.field[_][11]then if P.field[_].garbage then
P.garbageBeneath=P.garbageBeneath-1 P.garbageBeneath=P.garbageBeneath-1
gbcc=gbcc+1 gbcc=gbcc+1
end end