autobuy merge

This commit is contained in:
ntr 2019-12-08 16:09:10 +10:00
parent 44c541edf8
commit b9c754dc02

View File

@ -159,6 +159,7 @@ impl Player {
// do we have any colours in store?
let colours = self.vbox.store[&ItemType::Colours].keys()
.cloned()
.take(2)
.collect::<Vec<String>>();
// how about a base skill?
@ -168,11 +169,13 @@ impl Player {
};
// if no: try to refill and start again
match colours.len() < 2 || base.is_none() {
true => match self.vbox_refill() {
Ok(_) => continue,
Err(_) => break, // give up
},
match colours.len() != 2 || base.is_none() {
true => {
match self.vbox_refill() {
Ok(_) => continue,
Err(_) => break, // give up
};
}
false => {
let mut vbox_items = HashMap::new();
vbox_items.insert(ItemType::Colours, colours);
@ -205,7 +208,7 @@ impl Player {
// there's a bad bug here where if this apply fails
// the item in question will be silently dropped
let item = self.vbox.stash.remove(&i).unwrap();
self.vbox_apply(item, construct_id).ok();
self.vbox_apply(item, construct_id).unwrap();
continue;
}
// need to buy one
@ -213,6 +216,7 @@ impl Player {
// do we have any colours in store?
let colours = self.vbox.store[&ItemType::Colours].keys()
.cloned()
.take(2)
.collect::<Vec<String>>();
// how about a base spec?
@ -222,7 +226,7 @@ impl Player {
};
// if no: try to refill and start again
match colours.len() < 2 || base.is_none() {
match colours.len() != 2 || base.is_none() {
true => match self.vbox_refill() {
Ok(_) => continue,
Err(_) => break, // give up