summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/storage.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/storage.rs b/src/storage.rs
index 3c6e684..5cae0ff 100644
--- a/src/storage.rs
+++ b/src/storage.rs
@@ -29,7 +29,11 @@ impl Storage {
pub fn take(&mut self, name : &str) -> Option<Item> {
match self.items.iter().position(|item| item.name == name) {
- Some(index) => Some(self.items.remove(index)),
+ Some(index) => {
+ let item = self.items.remove(index);
+ self.carrying -= item.size;
+ Some(item)
+ }
None => None,
}
}