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:
@@ -210,16 +210,6 @@ const (
|
||||
NumTrapTypes = 8
|
||||
)
|
||||
|
||||
// String returns the trap's display name, article included, as the C
|
||||
// tr_name table had it.
|
||||
func (t TrapKind) String() string {
|
||||
if t < 0 || t >= NumTrapTypes {
|
||||
return "a bizarre trap"
|
||||
}
|
||||
|
||||
return trName[t]
|
||||
}
|
||||
|
||||
// PotionKind identifies a potion (rogue.h potion types).
|
||||
type PotionKind int
|
||||
|
||||
@@ -242,15 +232,6 @@ const (
|
||||
NumPotionTypes
|
||||
)
|
||||
|
||||
// String returns the potion's true name ("healing", "haste self", ...).
|
||||
func (p PotionKind) String() string {
|
||||
if p < 0 || p >= NumPotionTypes {
|
||||
return "strange potion"
|
||||
}
|
||||
|
||||
return basePotInfo[p].Name
|
||||
}
|
||||
|
||||
// ScrollKind identifies a scroll (rogue.h scroll types).
|
||||
type ScrollKind int
|
||||
|
||||
@@ -277,15 +258,6 @@ const (
|
||||
NumScrollTypes
|
||||
)
|
||||
|
||||
// String returns the scroll's true name ("magic mapping", ...).
|
||||
func (s ScrollKind) String() string {
|
||||
if s < 0 || s >= NumScrollTypes {
|
||||
return "strange scroll"
|
||||
}
|
||||
|
||||
return baseScrInfo[s].Name
|
||||
}
|
||||
|
||||
// WeaponKind identifies a weapon (rogue.h weapon types).
|
||||
type WeaponKind int
|
||||
|
||||
@@ -307,15 +279,6 @@ const (
|
||||
// just past them in the tables (C's MAXWEAPONS == FLAME).
|
||||
const NumWeaponTypes = WeaponFlame
|
||||
|
||||
// String returns the weapon's name ("mace", "two handed sword", ...).
|
||||
func (w WeaponKind) String() string {
|
||||
if w < 0 || w > WeaponFlame {
|
||||
return "strange weapon"
|
||||
}
|
||||
|
||||
return baseWeapInfo[w].Name
|
||||
}
|
||||
|
||||
// ArmorKind identifies a suit of armor (rogue.h armor types).
|
||||
type ArmorKind int
|
||||
|
||||
@@ -332,15 +295,6 @@ const (
|
||||
NumArmorTypes
|
||||
)
|
||||
|
||||
// String returns the armor's name ("ring mail", "plate mail", ...).
|
||||
func (a ArmorKind) String() string {
|
||||
if a < 0 || a >= NumArmorTypes {
|
||||
return "strange armor"
|
||||
}
|
||||
|
||||
return baseArmInfo[a].Name
|
||||
}
|
||||
|
||||
// RingKind identifies a ring (rogue.h ring types).
|
||||
type RingKind int
|
||||
|
||||
@@ -363,15 +317,6 @@ const (
|
||||
NumRingTypes
|
||||
)
|
||||
|
||||
// String returns the ring's true name ("add strength", "stealth", ...).
|
||||
func (r RingKind) String() string {
|
||||
if r < 0 || r >= NumRingTypes {
|
||||
return "strange ring"
|
||||
}
|
||||
|
||||
return baseRingInfo[r].Name
|
||||
}
|
||||
|
||||
// WandKind identifies a wand or staff (rogue.h rod/wand/staff types).
|
||||
type WandKind int
|
||||
|
||||
@@ -394,15 +339,6 @@ const (
|
||||
NumWandTypes
|
||||
)
|
||||
|
||||
// String returns the wand/staff's true name ("lightning", ...).
|
||||
func (w WandKind) String() string {
|
||||
if w < 0 || w >= NumWandTypes {
|
||||
return "strange stick"
|
||||
}
|
||||
|
||||
return baseWsInfo[w].Name
|
||||
}
|
||||
|
||||
// Coord is a position on the level (rogue.h coord). A value type: the C
|
||||
// ce(a,b) macro is plain == here.
|
||||
type Coord struct {
|
||||
|
||||
Reference in New Issue
Block a user