diff options
Diffstat (limited to 'internal/game/cmd_drop.go')
| -rw-r--r-- | internal/game/cmd_drop.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/internal/game/cmd_drop.go b/internal/game/cmd_drop.go index 1fd99b4..d3141e3 100644 --- a/internal/game/cmd_drop.go +++ b/internal/game/cmd_drop.go @@ -5,12 +5,11 @@ import ( "strings" "thehouseoficarus/internal/net" - "thehouseoficarus/internal/player" ) func (g *Game) doDropAll(sess *net.Session) { - p := sess.Player.(*player.Player) - g.CancelAction(p) + p := sess.Player + g.cancelAction(p) p.ActionState = &ActionState{Type: ActionDropping, TargetName: "inventory"} count := 0 @@ -28,8 +27,8 @@ func (g *Game) doDropAll(sess *net.Session) { } func (g *Game) doDropAllNamed(sess *net.Session, input string) { - p := sess.Player.(*player.Player) - g.CancelAction(p) + p := sess.Player + g.cancelAction(p) matches := g.findInventoryMatches(input, p) if len(matches) == 0 { @@ -86,8 +85,8 @@ func (g *Game) doDropAllNamed(sess *net.Session, input string) { } func (g *Game) doDrop(sess *net.Session, input string) { - p := sess.Player.(*player.Player) - g.CancelAction(p) + p := sess.Player + g.cancelAction(p) qty, itemName := parseQty(input) @@ -182,14 +181,14 @@ func (g *Game) doDrop(sess *net.Session, input string) { } func (g *Game) handleDropAllConfirm(sess *net.Session, input string) { - p, ok := sess.Player.(*player.Player) - if !ok { + p := sess.Player + if p == nil { sess.State = net.StateGame g.writePrompt(sess) return } - g.CancelAction(p) + g.cancelAction(p) input = strings.TrimSpace(strings.ToLower(input)) if input != "y" && input != "yes" { sess.State = net.StateGame |
