make cc update field when block placement is wrong

This commit is contained in:
Gompyn
2020-07-29 15:01:38 +08:00
parent 17d670a1ba
commit 71130bbced
2 changed files with 22 additions and 1 deletions

View File

@@ -275,11 +275,17 @@ return{
return 2
end,--start thinking
function(P,ctrl)
local success,hold,move=BOT.getMove(P.AI_bot)
local success,dest,hold,move=BOT.getMove(P.AI_bot)
if success == 2 then
ins(ctrl,6)
return 3
elseif success == 0 then
for i=1,#dest do
for j=1,#dest[i] do
dest[i][j] = dest[i][j] + 1
end
end
P.AI_dest = dest
if hold then ctrl[1]=8 end--Hold
while move[1]do
local m=rem(move,1)

View File

@@ -1273,6 +1273,7 @@ function player.freshLockDelay(P)
end
end
function player.lock(P)
local dest = P.AI_dest
for i=1,P.r do
local y=P.curY+i-1
if not P.field[y]then P.field[y],P.visTime[y]=freeRow.get(0),freeRow.get(0)end
@@ -1280,6 +1281,20 @@ function player.lock(P)
if P.cur.bk[i][j]then
P.field[y][P.curX+j-1]=P.cur.color
P.visTime[y][P.curX+j-1]=P.showTime
local x = P.curX+j-1
if dest then
local original_length = #dest
for k=1,original_length do
if x == dest[k][1] and y == dest[k][2] then
rem(dest, k)
break
end
end
if #dest ~= original_length - 1 then
CC_updateField(P)
dest = nil
end
end
end
end
end