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

@@ -101,7 +101,7 @@ func (g *RogueGame) putOpt(op *optDesc) {
case optBool, optSeeFloor:
hw.AddStr(boolStr(*op.boolP))
case optInvT:
hw.AddStr(invTName[*op.intP])
hw.AddStr(g.data.invTName[*op.intP])
case optStr:
hw.AddStr(*op.strP)
}
@@ -291,7 +291,7 @@ func displayStr(buf []byte) string {
func (g *RogueGame) getInvT(ip *int) int {
win := g.scr.Hw
oy, ox := win.GetYX()
win.AddStr(invTName[*ip])
win.AddStr(g.data.invTName[*ip])
for {
win.Move(oy, ox)
@@ -319,7 +319,7 @@ func (g *RogueGame) getInvT(ip *int) int {
break
}
win.MvPrintwf(oy, ox, "%s\n", invTName[*ip])
win.MvPrintwf(oy, ox, "%s\n", g.data.invTName[*ip])
return Norm
}
@@ -383,7 +383,7 @@ func (g *RogueGame) ParseOpts(str string) {
w = string(toUpper(w[0])) + w[1:]
}
for ti, tn := range invTName {
for ti, tn := range g.data.invTName {
if strings.HasPrefix(tn, w) {
*op.intP = ti