diff --git a/main.lua b/main.lua index 2e1fc6a3..b8f262fc 100644 --- a/main.lua +++ b/main.lua @@ -366,30 +366,6 @@ do end newVersionLaunch=true - --Try unlock modes which should be unlocked & delete old ranks - for name,rank in next,RANKS do - if rank and rank>0 then - local exist - for _,mode in next,MODES do - if mode.name==name then - if mode.score then - exist=true - end - if mode.unlock then - for _,unlockName in next,mode.unlock do - if not RANKS[unlockName]then - RANKS[unlockName]=0 - end - end - end - end - end - if not exist then - RANKS[name]=nil - end - end - end - S.version=VERSION_CODE FILE.save(RANKS,"conf/unlock","q") FILE.save(STAT,"conf/data") diff --git a/parts/scenes/load.lua b/parts/scenes/load.lua index 006a06a1..0f142460 100644 --- a/parts/scenes/load.lua +++ b/parts/scenes/load.lua @@ -174,6 +174,21 @@ function scene.update() gc.setCanvas() elseif phase==9 then SKIN.change(SETTING.skinSet) + if newVersionLaunch then--Delete old ranks & Unlock modes which should be unlocked + for name,rank in next,RANKS do + local M=MODES[name] + if M and M.unlock and rank>0 then + for _,unlockName in next,M.unlock do + if not RANKS[unlockName]then + RANKS[unlockName]=0 + end + end + end + if not(M and M.score)then + RANKS[name]=nil + end + end + end STAT.run=STAT.run+1 LOADED=true SFX.play("welcome_sfx")