Rename constructor to game.New(game.Params) per styleguide
NewGame(Config) becomes New(Params), and Restore takes Params too, so the package's primary type gets the canonical New() constructor with a named-field Params struct (styleguide points 139, 159). cmd/rogue and all tests updated; ARCHITECTURE.md constructor references corrected. Pure rename, suite green.
This commit is contained in:
@@ -681,7 +681,7 @@ var ErrSaveOutOfDate = errors.New("sorry, saved game is out of date")
|
||||
|
||||
// Restore restores a saved game from a file (save.c restore). The file is
|
||||
// deleted, as in C, to defeat restarting from the same save.
|
||||
func Restore(path string, cfg Config) (*RogueGame, error) {
|
||||
func Restore(path string, params Params) (*RogueGame, error) {
|
||||
f, err := os.Open(path) //nolint:gosec // G304: the save path is user-chosen by design
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -704,12 +704,12 @@ func Restore(path string, cfg Config) (*RogueGame, error) {
|
||||
data: newGameData(),
|
||||
Rng: &Rng{},
|
||||
Playing: true,
|
||||
ScorePath: cfg.ScorePath,
|
||||
ScorePath: params.ScorePath,
|
||||
FileName: path,
|
||||
rogueOpts: cfg.RogueOpts,
|
||||
rogueOpts: params.RogueOpts,
|
||||
restored: true,
|
||||
}
|
||||
g.scr = NewScreen(cfg.Term)
|
||||
g.scr = NewScreen(params.Term)
|
||||
g.Msgs.attach(g.scr, g.look, g.readchar)
|
||||
g.applySnapshot(&st)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user