From 079df7a6acb0e33905c1ddcd4a9ea5d49ee2b60b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Gim=C3=A9nez?= Date: Sun, 19 May 2024 20:45:43 +0900 Subject: [PATCH] filter by location type --- pkg/data/items.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/data/items.go b/pkg/data/items.go index 1d666ad..e3e5061 100644 --- a/pkg/data/items.go +++ b/pkg/data/items.go @@ -14,7 +14,7 @@ type Inventory struct { StashedGold [4]int } -func (i Inventory) Find(name item.Name, locations ...item.Location) (Item, bool) { +func (i Inventory) Find(name item.Name, locations ...item.LocationType) (Item, bool) { for _, it := range i.AllItems { if strings.EqualFold(string(it.Name), string(name)) { // If no locations are specified, return the first item found @@ -23,7 +23,7 @@ func (i Inventory) Find(name item.Name, locations ...item.Location) (Item, bool) } for _, l := range locations { - if it.Location == l { + if it.Location.LocationType == l { return it, true } }