block writes while reading
Disabling writes during "wipe" and "first load" is not quite semantically what we want, it's writes during read we want to block. This happens because turning the music on or off tries to save the state, and it's easier to just ignore that persistence request than to rework the music code so it doesn't. "wipe" and "first load" are when we're actually reading (and enacting) state, but it's the act of reading rather than those two acts that should block writes. It is also unwilling to write until it's done its first read, which I think is a feature; it makes it harder to accidentally blank out the player's data.
This commit is contained in:
parent
7b931d1fba
commit
04d2a680dd
@ -1915,24 +1915,23 @@ function persist:init0()
|
||||
cartdata("ulimate_lizard_total_destruction_0_1")
|
||||
self.init0 = self.read
|
||||
self:read()
|
||||
self.ready=true
|
||||
end
|
||||
|
||||
function persist:read()
|
||||
self.ready=false
|
||||
local m = dget(0) == 0
|
||||
self.music = m
|
||||
if m then music_on() else music_off() end
|
||||
self.max_level = dget(1)
|
||||
self.recent_level = dget(2)
|
||||
self.ready=true
|
||||
end
|
||||
|
||||
function persist:wipe()
|
||||
self.ready=false
|
||||
for i=0,64 do
|
||||
dset(i,0)
|
||||
end
|
||||
self:read()
|
||||
self.ready=true
|
||||
end
|
||||
|
||||
function persist:lvlstart()
|
||||
|
Loading…
Reference in New Issue
Block a user