Skip to content

Commit

Permalink
Fixed bug: loading save data may fail when the file contains 0x1A (EO…
Browse files Browse the repository at this point in the history
…F) byte.
  • Loading branch information
Bakudankun committed Oct 7, 2020
1 parent b4028f7 commit 07aa84b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions autoload/rogue/save.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ g.save_file = 'rogue_vim.save'

local function save_into_file(fname)
fname = g.expand_fname(fname, g.game_dir)
local fp = io.open(fname, "w")
local fp = io.open(fname, "wb")
if not fp then
g.message(g.mesg[503])
return
Expand Down Expand Up @@ -100,7 +100,7 @@ end

function g.restore(fname)
fname = g.expand_fname(fname, g.game_dir)
local fp = io.open(fname, "r")
local fp = io.open(fname, "rb")
if not fp then
g.message(g.mesg[504])
return false
Expand Down
4 changes: 2 additions & 2 deletions autoload/rogue/score.lua
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ end
function g.put_scores(monster, other)
local scores = {}
local file = g.game_dir .. score_file
local fp = io.open(file, "r")
local fp = io.open(file, "rb")
if fp then
local buf = fp:read("*a")
g.xxx(true)
Expand All @@ -366,7 +366,7 @@ function g.put_scores(monster, other)
end

if rank <= MAX_RANK then
fp = io.open(file, "w")
fp = io.open(file, "wb")
if not fp then
g.message(g.mesg[186])
sf_error()
Expand Down

0 comments on commit 07aa84b

Please sign in to comment.