Skip to content

Commit

Permalink
Correct inventory index when using search.
Browse files Browse the repository at this point in the history
  • Loading branch information
riperiperi committed Oct 4, 2022
1 parent 345492a commit 5609493
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions TSOClient/tso.client/UI/Panels/UIBuyMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ public override void Update(UpdateState state)
CurrentInventory.Add(new UICatalogElement {
Item = obj,
Attributes = item.Attributes ?? new List<int>(),
Tag = item.ObjectPID,
Count = (item.AttributeMode == 2 && (item.Attributes?.Count ?? 0) > 0) ? item.Attributes[0] : (int?)null
});
}
Expand Down Expand Up @@ -253,6 +254,12 @@ override protected void Catalog_OnSelectionChange(int selection)
{
if (selection < LastInventory.Count && Holder.Holding != null)
{
if (Catalog.Filtered != Catalog.Selected)
{
var selTag = Catalog.Filtered[selection].Tag;
selection = Catalog.Selected.FindIndex(elem => elem.Tag == selTag);
}

Holder.Holding.InventoryPID = LastInventory[selection].ObjectPID;
Holder.Holding.Price = 0;
}
Expand Down

0 comments on commit 5609493

Please sign in to comment.