修复遗漏break
This commit is contained in:
12
main.lua
12
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,8 +568,7 @@ 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)
|
||||||
@@ -579,7 +577,7 @@ for _,fileName in next,fs.getDirectoryItems('replay') do
|
|||||||
not mod or
|
not mod or
|
||||||
not mode or
|
not mode or
|
||||||
#mode==0
|
#mode==0
|
||||||
then break end-- goto BREAK_cannotParse
|
then break end
|
||||||
|
|
||||||
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)
|
||||||
@@ -598,7 +596,7 @@ for _,fileName in next,fs.getDirectoryItems('replay') do
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
fileName=newName
|
fileName=newName
|
||||||
until true-- ::BREAK_cannotParse::
|
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
|
||||||
-- <for-else> All test failed, interrupt with sound
|
end
|
||||||
if not success then
|
if not success then -- All test failed, interrupt with sound
|
||||||
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
|
||||||
|
|
||||||
@@ -1350,17 +1350,17 @@ function Player:hold_swap(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
|
||||||
-- <for-else> All test failed, interrupt with sound
|
end
|
||||||
if not success then
|
if not success then -- All test failed, interrupt with sound
|
||||||
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