update code

This commit is contained in:
vietdungdev
2026-05-21 19:55:37 +07:00
parent e1679a2d11
commit 88548e97fc

View File

@@ -75,11 +75,15 @@ func (i Inventory) FindByID(unitID UnitID) (Item, bool) {
return Item{}, false return Item{}, false
} }
func (i Inventory) ByOwnerLocation(owner UnitID, locations ...item.LocationType) []Item { func (i Inventory) ByMercLocation(mercID UnitID, locations ...item.LocationType) []Item {
var items []Item var items []Item
for _, it := range i.AllItems { for _, it := range i.AllItems {
for _, l := range locations { for _, l := range locations {
owner := mercID
if l != item.LocationMercenary {
owner = i.PlayerID
}
if it.Location.LocationType == l && isMatchOwner(owner, it) { if it.Location.LocationType == l && isMatchOwner(owner, it) {
items = append(items, it) items = append(items, it)
} }