Move all package-level vars into gameData; finish lint adoption

gochecknoglobals: all 37 package-level tables consolidated into the
gameData struct (game/tables.go), built by newGameData() and carried
on RogueGame as g.data (set in NewGame and Restore). ObjectKind
Glyph()/objectKindForGlyph are now switches; the table-reading subtype
Stringer methods are gone; isMagic is a RogueGame method.

goconst: repeated words named (potionName/scrollName/ringName/goldName
in object.go, wandName/staffName in sticks.go, ripWall in tables.go).

exhaustive, testpackage: disabled in .golangci.yml with sneak's
approval (2026-07-07).

Also reverts misspell's silent corruption of the "ther" scroll-name
syllable (it had become "there", changing generated scroll names vs C).

Remaining red: cyclop/gocognit/nestif until refactor step 7; mnd
awaits a ruling. TODO.md rotated; MEMORY.md lint notes updated.
This commit is contained in:
2026-07-07 02:10:58 +02:00
parent 50afbec8e3
commit a8feb6c05d
28 changed files with 796 additions and 711 deletions

View File

@@ -138,6 +138,9 @@ type RogueGame struct {
rogueOpts string // the ROGUEOPTS string, re-parsed by playit as in C
restored bool // game came from a save file; Run skips setup
// data is the game's copy of the static tables (extern.c and friends).
data *gameData
}
// NewGame builds a game from cfg, seeds the RNG, and randomizes the item
@@ -145,6 +148,7 @@ type RogueGame struct {
// and first level arrive with later porting phases).
func NewGame(cfg Config) *RogueGame {
g := &RogueGame{
data: newGameData(),
Rng: &Rng{Seed: cfg.Seed},
Dnum: int(cfg.Seed),
Whoami: cfg.Name,
@@ -176,7 +180,7 @@ func NewGame(cfg Config) *RogueGame {
g.ParseOpts(cfg.RogueOpts)
}
g.Monsters = monsterTable
g.Monsters = g.data.monsterTable
g.Items.Group = 2 // weapons.c: int group = 2
for i := range g.Level.Passages {