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:
@@ -373,9 +373,9 @@ over:
|
||||
case g.Level.Char(g.Delta.Y, g.Delta.X) != Trap:
|
||||
g.msg("no trap there")
|
||||
case p.On(Hallucinating):
|
||||
g.msg("%s", trName[g.rnd(NumTrapTypes)])
|
||||
g.msg("%s", g.data.trName[g.rnd(NumTrapTypes)])
|
||||
default:
|
||||
g.msg("%s", trName[*fp&FTrapMask])
|
||||
g.msg("%s", g.data.trName[*fp&FTrapMask])
|
||||
fp.Set(FSeen)
|
||||
}
|
||||
}
|
||||
@@ -540,9 +540,9 @@ func (g *RogueGame) search() {
|
||||
}
|
||||
|
||||
if p.On(Hallucinating) {
|
||||
g.msg("%s", trName[g.rnd(NumTrapTypes)])
|
||||
g.msg("%s", g.data.trName[g.rnd(NumTrapTypes)])
|
||||
} else {
|
||||
g.msg("%s", trName[*fp&FTrapMask])
|
||||
g.msg("%s", g.data.trName[*fp&FTrapMask])
|
||||
fp.Set(FSeen)
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ func (g *RogueGame) help() {
|
||||
if helpch != '*' {
|
||||
g.move(0, 0)
|
||||
|
||||
for _, strp := range helpStr {
|
||||
for _, strp := range g.data.helpStr {
|
||||
if strp.Ch == helpch {
|
||||
g.Msgs.LowerMsg = true
|
||||
g.msg("%s%s", unctrl(strp.Ch), strp.Desc)
|
||||
@@ -602,7 +602,7 @@ func (g *RogueGame) help() {
|
||||
// command mode.
|
||||
numprint := 0
|
||||
|
||||
for _, strp := range helpStr {
|
||||
for _, strp := range g.data.helpStr {
|
||||
if strp.Print {
|
||||
numprint++
|
||||
}
|
||||
@@ -622,7 +622,7 @@ func (g *RogueGame) help() {
|
||||
|
||||
cnt := 0
|
||||
|
||||
for _, strp := range helpStr {
|
||||
for _, strp := range g.data.helpStr {
|
||||
if !strp.Print {
|
||||
continue
|
||||
}
|
||||
@@ -652,28 +652,6 @@ func (g *RogueGame) help() {
|
||||
g.refresh()
|
||||
}
|
||||
|
||||
// identList is command.c's static ident_list.
|
||||
var identList = []helpEntry{
|
||||
{'|', "wall of a room", false},
|
||||
{'-', "wall of a room", false},
|
||||
{Gold, "gold", false},
|
||||
{Stairs, "a staircase", false},
|
||||
{Door, "door", false},
|
||||
{Floor, "room floor", false},
|
||||
{PlayerCh, "you", false},
|
||||
{Passage, "passage", false},
|
||||
{Trap, "trap", false},
|
||||
{Potion, "potion", false},
|
||||
{Scroll, "scroll", false},
|
||||
{Food, "food", false},
|
||||
{Weapon, "weapon", false},
|
||||
{' ', "solid rock", false},
|
||||
{Armor, "armor", false},
|
||||
{Amulet, "the Amulet of Yendor", false},
|
||||
{Ring, "ring", false},
|
||||
{Stick, "wand or staff", false},
|
||||
}
|
||||
|
||||
// identify tells the player what a certain thing is (command.c identify).
|
||||
func (g *RogueGame) identify() {
|
||||
g.msg("what do you want identified? ")
|
||||
@@ -692,7 +670,7 @@ func (g *RogueGame) identify() {
|
||||
} else {
|
||||
str = "unknown character"
|
||||
|
||||
for _, hp := range identList {
|
||||
for _, hp := range g.data.identList {
|
||||
if hp.Ch == ch {
|
||||
str = hp.Desc
|
||||
|
||||
|
||||
Reference in New Issue
Block a user