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:
2026-07-07 02:31:38 +02:00
parent 0554f5d4f1
commit 6d798c56ed
14 changed files with 57 additions and 56 deletions

View File

@@ -453,7 +453,7 @@ func (g *RogueGame) wizardCommand(ch byte) {
case CTRL('X'):
g.turnSee(p.On(SenseMonsters))
case CTRL('~'):
if item := g.getItem("charge", KindWand); item != nil {
if item, ok := g.promptPackItem("charge", KindWand); ok {
item.Charges = 10000
}
case CTRL('I'):
@@ -738,9 +738,9 @@ func (g *RogueGame) levitCheck() bool {
// call allows a user to call a potion, scroll, or ring something
// (command.c call).
func (g *RogueGame) call() {
obj := g.getItem("call", KindCallable)
obj, ok := g.promptPackItem("call", KindCallable)
// Make certain that it is something that we want to name
if obj == nil {
if !ok {
return
}
@@ -820,7 +820,7 @@ func (g *RogueGame) current(cur *Object, how, where string) {
}
g.InvDescribe = false
g.addmsgf("%c) %s", cur.PackCh, g.invName(cur, true))
g.addmsgf("%c) %s", cur.PackCh, g.inventoryName(cur, true))
g.InvDescribe = true
if where != "" {