修复遗漏break
This commit is contained in:
60
main.lua
60
main.lua
@@ -10,8 +10,7 @@
|
|||||||
Instructions:
|
Instructions:
|
||||||
1. I made a framework called Zframework, *most* code in Zframework are not directly relevant to game;
|
1. I made a framework called Zframework, *most* code in Zframework are not directly relevant to game;
|
||||||
2. "xxx" are texts for reading by player, 'xxx' are string values just used in program;
|
2. "xxx" are texts for reading by player, 'xxx' are string values just used in program;
|
||||||
3. Some goto statement are used for better performance. All goto-labes have detailed names so don't be afraid;
|
3. Except "gcinfo" function of lua itself, other "gc" are short for "graphics";
|
||||||
4. Except "gcinfo" function of lua itself, other "gc" are short for "graphics";
|
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
|
||||||
@@ -560,7 +559,7 @@ applySettings()
|
|||||||
|
|
||||||
-- Load replays
|
-- Load replays
|
||||||
for _,fileName in next,fs.getDirectoryItems('replay') do
|
for _,fileName in next,fs.getDirectoryItems('replay') do
|
||||||
if fileName:sub(12,12):match("[a-zA-Z]") then
|
while fileName:sub(12,12):match("[a-zA-Z]") do
|
||||||
local date,mode,version,player,seed,setting,mod
|
local date,mode,version,player,seed,setting,mod
|
||||||
local fileData=fs.read('replay/'..fileName)
|
local fileData=fs.read('replay/'..fileName)
|
||||||
date, fileData=STRING.readLine(fileData)date=date:gsub("[a-zA-Z]","")
|
date, fileData=STRING.readLine(fileData)date=date:gsub("[a-zA-Z]","")
|
||||||
@@ -569,36 +568,35 @@ for _,fileName in next,fs.getDirectoryItems('replay') do
|
|||||||
player, fileData=STRING.readLine(fileData) if player=="Local Player" then player="Stacker" end
|
player, fileData=STRING.readLine(fileData) if player=="Local Player" then player="Stacker" end
|
||||||
local success
|
local success
|
||||||
success,fileData=pcall(love.data.decompress,'string','zlib',fileData)
|
success,fileData=pcall(love.data.decompress,'string','zlib',fileData)
|
||||||
repeat
|
if not success then break end
|
||||||
if not success then break end-- goto BREAK_cannotParse
|
seed, fileData=STRING.readLine(fileData)
|
||||||
seed, fileData=STRING.readLine(fileData)
|
setting,fileData=STRING.readLine(fileData)setting=JSON.decode(setting)
|
||||||
setting,fileData=STRING.readLine(fileData)setting=JSON.decode(setting)
|
mod, fileData=STRING.readLine(fileData)mod=JSON.decode(mod)
|
||||||
mod, fileData=STRING.readLine(fileData)mod=JSON.decode(mod)
|
if
|
||||||
if
|
not setting or
|
||||||
not setting or
|
not mod or
|
||||||
not mod or
|
not mode or
|
||||||
not mode or
|
#mode==0
|
||||||
#mode==0
|
then break end
|
||||||
then break end-- goto BREAK_cannotParse
|
|
||||||
|
|
||||||
fs.remove('replay/'..fileName)
|
fs.remove('replay/'..fileName)
|
||||||
local newName=fileName:sub(1,10)..fileName:sub(15)
|
local newName=fileName:sub(1,10)..fileName:sub(15)
|
||||||
fs.write('replay/'..newName,
|
fs.write('replay/'..newName,
|
||||||
love.data.compress('string','zlib',
|
love.data.compress('string','zlib',
|
||||||
JSON.encode{
|
JSON.encode{
|
||||||
date=date,
|
date=date,
|
||||||
mode=mode,
|
mode=mode,
|
||||||
version=version,
|
version=version,
|
||||||
player=player,
|
player=player,
|
||||||
seed=seed,
|
seed=seed,
|
||||||
setting=setting,
|
setting=setting,
|
||||||
mod=mod,
|
mod=mod,
|
||||||
}.."\n"..
|
}.."\n"..
|
||||||
fileData
|
fileData
|
||||||
)
|
|
||||||
)
|
)
|
||||||
fileName=newName
|
)
|
||||||
until true-- ::BREAK_cannotParse::
|
fileName=newName
|
||||||
|
break
|
||||||
end
|
end
|
||||||
local rep=DATA.parseReplay('replay/'..fileName)
|
local rep=DATA.parseReplay('replay/'..fileName)
|
||||||
table.insert(REPLAY,rep)
|
table.insert(REPLAY,rep)
|
||||||
|
|||||||
@@ -1279,17 +1279,17 @@ function Player:hold_norm(ifpre)
|
|||||||
if not self:ifoverlap(H.bk,X,Y) then
|
if not self:ifoverlap(H.bk,X,Y) then
|
||||||
x,y=X,Y
|
x,y=X,Y
|
||||||
success=true
|
success=true
|
||||||
break-- goto BREAK_success
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if success then
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- <for-else> All test failed, interrupt with sound
|
if not success then -- All test failed, interrupt with sound
|
||||||
if not success then
|
|
||||||
SFX.play('drop_cancel')
|
SFX.play('drop_cancel')
|
||||||
do return end
|
do return end
|
||||||
end
|
end
|
||||||
-- <for-end>
|
|
||||||
-- ::BREAK_success::
|
|
||||||
|
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
|
|
||||||
@@ -1344,23 +1344,23 @@ function Player:hold_swap(ifpre)
|
|||||||
|
|
||||||
local iki=phyHoldKickX[x==int(x)]
|
local iki=phyHoldKickX[x==int(x)]
|
||||||
local success
|
local success
|
||||||
for Y=int(y),ceil(y+.5) do
|
for Y=int(y),ceil(y+.5) do
|
||||||
for i=1,#iki do
|
for i=1,#iki do
|
||||||
local X=x+iki[i]
|
local X=x+iki[i]
|
||||||
if not self:ifoverlap(H.bk,X,Y) then
|
if not self:ifoverlap(H.bk,X,Y) then
|
||||||
x,y=X,Y
|
x,y=X,Y
|
||||||
success=true
|
success=true
|
||||||
break-- goto BREAK_success
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if success then
|
||||||
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
if not success then -- All test failed, interrupt with sound
|
||||||
-- <for-else> All test failed, interrupt with sound
|
|
||||||
if not success then
|
|
||||||
SFX.play('finesseError')
|
SFX.play('finesseError')
|
||||||
do return end
|
do return end
|
||||||
end
|
end
|
||||||
-- <for-end>
|
|
||||||
-- ::BREAK_success::
|
|
||||||
|
|
||||||
self.spinLast=false
|
self.spinLast=false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user