Rename item-subsystem methods (refactor step 5, items)
getItem→promptPackItem now returns (obj, ok) instead of a nil-signaling pointer; invName→inventoryName; doPot→applyPotionFuse. C breadcrumbs kept. Behavior unchanged; suite green.
This commit is contained in:
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// invName returns the name of something as it would appear in an inventory
|
||||
// (things.c inv_name).
|
||||
func (g *RogueGame) invName(obj *Object, drop bool) string {
|
||||
func (g *RogueGame) inventoryName(obj *Object, drop bool) string {
|
||||
var pb strings.Builder
|
||||
|
||||
which := obj.Which
|
||||
@@ -142,8 +142,8 @@ func (g *RogueGame) dropIt() {
|
||||
return
|
||||
}
|
||||
|
||||
obj := g.getItem("drop", KindNone)
|
||||
if obj == nil {
|
||||
obj, ok := g.promptPackItem("drop", KindNone)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ func (g *RogueGame) dropIt() {
|
||||
g.HasAmulet = false
|
||||
}
|
||||
|
||||
g.msg("dropped %s", g.invName(obj, true))
|
||||
g.msg("dropped %s", g.inventoryName(obj, true))
|
||||
}
|
||||
|
||||
// dropCheck does special checks for dropping or unwielding|unwearing|
|
||||
@@ -392,7 +392,7 @@ func (g *RogueGame) printDisc(typ byte) {
|
||||
if info[order[i]].Know || info[order[i]].Guess != "" {
|
||||
obj.Kind = objectKindForGlyph(typ)
|
||||
obj.Which = order[i]
|
||||
g.addLine("%s", g.invName(&obj, false))
|
||||
g.addLine("%s", g.inventoryName(&obj, false))
|
||||
|
||||
numFound++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user