Split applyHeader turn-state half; drop inline stat err
This commit is contained in:
@@ -369,6 +369,12 @@ func (g *RogueGame) applyHeader(st *SaveState) {
|
|||||||
g.Level.Passages = st.Passages
|
g.Level.Passages = st.Passages
|
||||||
g.Level.Stairs = st.Stairs
|
g.Level.Stairs = st.Stairs
|
||||||
g.Level.TrapCount = st.TrapCount
|
g.Level.TrapCount = st.TrapCount
|
||||||
|
g.applyTurnState(st)
|
||||||
|
}
|
||||||
|
|
||||||
|
// applyTurnState restores the in-turn command state (the second half of
|
||||||
|
// applyHeader).
|
||||||
|
func (g *RogueGame) applyTurnState(st *SaveState) {
|
||||||
g.After = st.After
|
g.After = st.After
|
||||||
g.Again = st.Again
|
g.Again = st.Again
|
||||||
g.NoScore = st.NoScoreF
|
g.NoScore = st.NoScoreF
|
||||||
@@ -598,7 +604,8 @@ func (g *RogueGame) saveFileName(useDefault bool) (string, bool) {
|
|||||||
// prompt, saveAbort quits (save.c save_game).
|
// prompt, saveAbort quits (save.c save_game).
|
||||||
func (g *RogueGame) saveCheckOverwrite(buf string) saveAnswer {
|
func (g *RogueGame) saveCheckOverwrite(buf string) saveAnswer {
|
||||||
// test to see if the file exists
|
// test to see if the file exists
|
||||||
if _, statErr := os.Stat(buf); statErr != nil {
|
_, statErr := os.Stat(buf)
|
||||||
|
if statErr != nil {
|
||||||
return saveYes
|
return saveYes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user