Skip to content

Commit

Permalink
If the game is suspended :Rogue command confirms whether you resume it.
Browse files Browse the repository at this point in the history
  • Loading branch information
katono committed Sep 10, 2014
1 parent f6a8b6a commit 4fe7bb1
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions autoload/rogue/rogue.vim
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,24 @@ function! rogue#rogue#main(args)
echo "Sorry. Rogue.vim needs '+lua'."
return
endif
if a:args !=# '--resume' || luaeval('type(Rogue)') !=# 'table'
\|| luaeval('tostring(Rogue.suspended)') !=# 'true'
let resume = 0
if luaeval('type(Rogue)') ==# 'table' &&
\ luaeval('tostring(Rogue.suspended)') ==# 'true'
if a:args ==# '--resume'
let resume = 1
else
let c = confirm("The game is suspended. Resume it?",
\ "&Yes\n&No\n&Cancel", 1)
if c == 1
let resume = 1
elseif c == 2
let resume = 0
else
return
endif
endif
endif
if !resume
execute 'luafile ' . s:FILE_DIR . 'main.lua'
execute 'luafile ' . s:FILE_DIR . 'const.lua'
execute 'luafile ' . s:FILE_DIR . 'curses.lua'
Expand Down

0 comments on commit 4fe7bb1

Please sign in to comment.