update code
This commit is contained in:
@@ -75,11 +75,15 @@ func (i Inventory) FindByID(unitID UnitID) (Item, bool) {
|
||||
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
|
||||
|
||||
for _, it := range i.AllItems {
|
||||
for _, l := range locations {
|
||||
owner := mercID
|
||||
if l != item.LocationMercenary {
|
||||
owner = i.PlayerID
|
||||
}
|
||||
if it.Location.LocationType == l && isMatchOwner(owner, it) {
|
||||
items = append(items, it)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user