Compare commits

..

No commits in common. "a7697fa1b2169d6e462d541b127bccb73acb6026" and "119155a90321b75fad6ac4b4a466760ac8ae53e7" have entirely different histories.

3 changed files with 6 additions and 17 deletions

View File

@ -96,9 +96,8 @@ function board:undo()
if (not self.checkpoint) return if (not self.checkpoint) return
if (not self.watcher:intercept("undo")) sounds:dire() return if (not self.watcher:intercept("undo")) sounds:dire() return
sounds:menu() sounds:menu()
local current_checkpoint=checkpoint:new(self,self.checkpoint.card)
self.checkpoint:apply(self) self.checkpoint:apply(self)
self.checkpoint=current_checkpoint self.checkpoint=nil
end end
function board:on_idle() function board:on_idle()

View File

@ -81,19 +81,15 @@ function cursor:toggle_grab()
self:restore_hover() self:restore_hover()
sounds:menu() sounds:menu()
elseif acc==acceptance_state.no_move or acc==acceptance_state.would_not_accept then elseif acc==acceptance_state.no_move or acc==acceptance_state.would_not_accept then
self:drop_grab() if (not self.board.watcher:intercept("cancel")) sounds:dire() return
self.grabbed=nil
self:restore_hover()
sounds:menu()
else else
assert(false,"invalid acceptance state") assert(false,"invalid acceptance state")
end end
end end
function cursor:drop_grab()
if (not self.board.watcher:intercept("cancel")) sounds:dire() return
self.grabbed=nil
self:restore_hover()
sounds:menu()
end
function cursor:update() function cursor:update()
if (self.wants_to_restore_hover) self:actually_restore_hover() if (self.wants_to_restore_hover) self:actually_restore_hover()
end end

View File

@ -41,13 +41,7 @@ function state_gameround:update()
if (btnp(2)) self.board.cursor:move_y(-1) if (btnp(2)) self.board.cursor:move_y(-1)
if (btnp(3)) self.board.cursor:move_y(1) if (btnp(3)) self.board.cursor:move_y(1)
if (btnp(4)) self.board.cursor:toggle_grab() if (btnp(4)) self.board.cursor:toggle_grab()
if btnp(5) and self.restart_frames < 4 then if (btnp(5)) self.board:undo()
if self.board.cursor:grabbed_card() then
self.board.cursor:drop_grab()
else
self.board:undo()
end
end
end end
if (self.board:is_won()) self.outcome="win" self.done=true main.state_manager:push(state_wonround:new(self.board)) if (self.board:is_won()) self.outcome="win" self.done=true main.state_manager:push(state_wonround:new(self.board))
end end