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:
@@ -2,16 +2,6 @@ package game
|
||||
|
||||
// scrolls.c — read a scroll and let it happen.
|
||||
|
||||
// idType maps identify scrolls to the kind of item they identify
|
||||
// (scrolls.c static id_type).
|
||||
var idType = [ScrollIdentifyRingOrStick + 1]ObjectKind{
|
||||
ScrollIdentifyPotion: KindPotion,
|
||||
ScrollIdentifyScroll: KindScroll,
|
||||
ScrollIdentifyWeapon: KindWeapon,
|
||||
ScrollIdentifyArmor: KindArmor,
|
||||
ScrollIdentifyRingOrStick: KindRingOrStick,
|
||||
}
|
||||
|
||||
// readScroll reads a scroll from the pack and does the appropriate thing
|
||||
// (scrolls.c read_scroll).
|
||||
func (g *RogueGame) readScroll() {
|
||||
@@ -136,7 +126,7 @@ func (g *RogueGame) readScroll() {
|
||||
// Identify, let him figure something out
|
||||
g.Items.Scrolls[obj.Which].Know = true
|
||||
g.msg("this scroll is an %s scroll", g.Items.Scrolls[obj.Which].Name)
|
||||
g.whatis(true, idType[obj.ScrollKind()])
|
||||
g.whatis(true, g.data.idType[obj.ScrollKind()])
|
||||
case ScrollMagicMapping:
|
||||
// Scroll of magic mapping.
|
||||
g.Items.Scrolls[ScrollMagicMapping].Know = true
|
||||
|
||||
Reference in New Issue
Block a user