mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Sort merchant inventories lexicographically by (quality, name, quantity)
in details mode.
This commit is contained in:
parent
8facf7b58d
commit
6899023fde
@ -360,7 +360,17 @@ impl<'a> InventoryScroller<'a> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
for (pos, item) in self.inventory.slots_with_id() {
|
let mut items = self.inventory.slots_with_id().collect::<Vec<_>>();
|
||||||
|
if self.details_mode && !self.is_us {
|
||||||
|
items.sort_by_cached_key(|(_, item)| {
|
||||||
|
(
|
||||||
|
item.is_none(),
|
||||||
|
item.as_ref()
|
||||||
|
.map(|i| (std::cmp::Reverse(i.quality()), i.name(), i.amount())),
|
||||||
|
)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
for (pos, item) in items.into_iter() {
|
||||||
if self.details_mode && !self.is_us && matches!(item, None) {
|
if self.details_mode && !self.is_us && matches!(item, None) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user