Tidy pack.go split: drop unused lp param and named returns
This commit is contained in:
@@ -98,7 +98,7 @@ func (g *RogueGame) packInsert(obj *Object, fromFloor bool) (*Object, bool) {
|
|||||||
if op := p.Pack[i]; op.Kind == obj.Kind && op.Which == obj.Which {
|
if op := p.Pack[i]; op.Kind == obj.Kind && op.Which == obj.Which {
|
||||||
var ok bool
|
var ok bool
|
||||||
|
|
||||||
obj, lp, merged, ok = g.packMatch(obj, op, i, lp, fromFloor)
|
obj, lp, merged, ok = g.packMatch(obj, op, i, fromFloor)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
@@ -156,7 +156,7 @@ func packScanWhich(pack []*Object, obj *Object, i, lp int) (int, int) {
|
|||||||
// anything else marks the insertion point (the matched-subtype switch
|
// anything else marks the insertion point (the matched-subtype switch
|
||||||
// of pack.c add_pack). It returns the resulting entry, the insert-after
|
// of pack.c add_pack). It returns the resulting entry, the insert-after
|
||||||
// index, whether a merge happened, and ok false when the pack is full.
|
// index, whether a merge happened, and ok false when the pack is full.
|
||||||
func (g *RogueGame) packMatch(obj, op *Object, i, lp int, fromFloor bool) (*Object, int, bool, bool) {
|
func (g *RogueGame) packMatch(obj, op *Object, i int, fromFloor bool) (*Object, int, bool, bool) {
|
||||||
switch {
|
switch {
|
||||||
case op.Kind.MergesInPack():
|
case op.Kind.MergesInPack():
|
||||||
if !g.packRoom(fromFloor, obj) {
|
if !g.packRoom(fromFloor, obj) {
|
||||||
@@ -393,8 +393,9 @@ func (g *RogueGame) pickyInven() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// promptPackItem picks something out of a pack for a purpose (pack.c
|
// promptPackItem picks something out of a pack for a purpose (pack.c
|
||||||
// get_item); ok reports whether the player chose an item.
|
// get_item); the second result reports whether the player chose an
|
||||||
func (g *RogueGame) promptPackItem(purpose string, kind ObjectKind) (obj *Object, ok bool) {
|
// item.
|
||||||
|
func (g *RogueGame) promptPackItem(purpose string, kind ObjectKind) (*Object, bool) {
|
||||||
p := &g.Player
|
p := &g.Player
|
||||||
if len(p.Pack) == 0 {
|
if len(p.Pack) == 0 {
|
||||||
g.msg("you aren't carrying anything")
|
g.msg("you aren't carrying anything")
|
||||||
|
|||||||
Reference in New Issue
Block a user