|
|
@ -36,16 +36,7 @@ impl Ord for ToolShopItem { |
|
|
|
|
|
|
|
impl PartialOrd for ToolShopItem {
|
|
|
|
fn partial_cmp(&self, other: &ToolShopItem) -> Option<std::cmp::Ordering> {
|
|
|
|
let a = match self {
|
|
|
|
ToolShopItem::Tool(t) => Tool{tool : *t}.as_individual_bytes(),
|
|
|
|
ToolShopItem::Tech(t) => t.as_bytes(),
|
|
|
|
};
|
|
|
|
let b = match other {
|
|
|
|
ToolShopItem::Tool(t) => Tool{tool : *t}.as_individual_bytes(),
|
|
|
|
ToolShopItem::Tech(t) => t.as_bytes(),
|
|
|
|
};
|
|
|
|
|
|
|
|
a.partial_cmp(&b)
|
|
|
|
Some(self.cmp(other))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
@ -285,7 +276,7 @@ impl<R: Rng + SeedableRng> ToolShop<R> { |
|
|
|
pub fn generate_tool_list(&mut self, character_level: usize) -> Vec<ToolShopItem> {
|
|
|
|
let mut tools = Vec::new().into_iter()
|
|
|
|
.chain(self.tools.0.clone().into_iter().map(ToolShopItem::Tool))
|
|
|
|
.chain(self.generate_techs(character_level).into_iter())
|
|
|
|
.chain(self.generate_techs(character_level))
|
|
|
|
.collect::<Vec<_>>();
|
|
|
|
tools.sort();
|
|
|
|
tools
|
|
|
|