Split applyHeader turn-state half; drop inline stat err

This commit is contained in:
2026-07-22 21:55:04 +07:00
parent 80484bcd31
commit 9083967ed3

View File

@@ -369,6 +369,12 @@ func (g *RogueGame) applyHeader(st *SaveState) {
g.Level.Passages = st.Passages
g.Level.Stairs = st.Stairs
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.Again = st.Again
g.NoScore = st.NoScoreF
@@ -598,7 +604,8 @@ func (g *RogueGame) saveFileName(useDefault bool) (string, bool) {
// prompt, saveAbort quits (save.c save_game).
func (g *RogueGame) saveCheckOverwrite(buf string) saveAnswer {
// test to see if the file exists
if _, statErr := os.Stat(buf); statErr != nil {
_, statErr := os.Stat(buf)
if statErr != nil {
return saveYes
}