From fde43a560d01c5458e5c191c4dcd1d3ca57d404c Mon Sep 17 00:00:00 2001 From: The Dax Date: Fri, 4 Jul 2025 12:34:03 -0400 Subject: [PATCH] Move it to a constant, and remove redundant comment --- src/inventory/mod.rs | 5 +++-- src/lib.rs | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/inventory/mod.rs b/src/inventory/mod.rs index a867abc..dc9d360 100644 --- a/src/inventory/mod.rs +++ b/src/inventory/mod.rs @@ -21,6 +21,8 @@ pub use storage::{ContainerType, Storage}; mod currency; pub use currency::CurrencyStorage; +use crate::INVENTORY_ACTION_DISCARD; + const MAX_NORMAL_STORAGE: usize = 35; const MAX_LARGE_STORAGE: usize = 50; @@ -164,8 +166,7 @@ impl Inventory { } pub fn process_action(&mut self, action: &ItemOperation) { - if action.operation_type == 145 { - // discard + if action.operation_type == INVENTORY_ACTION_DISCARD { let src_container = self.get_container_mut(&action.src_storage_id); let src_slot = src_container.get_slot_mut(action.src_container_index); *src_slot = Item::default(); diff --git a/src/lib.rs b/src/lib.rs index 629e930..eb49eb3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -75,3 +75,6 @@ pub const AETHERYTE_UNLOCK_BITMASK_SIZE: usize = 30; /// The size of the completed quest bitmask. pub const COMPLETED_QUEST_BITMASK_SIZE: usize = 691; + +/// The operation opcode/type when discarding an item from the inventory. +pub const INVENTORY_ACTION_DISCARD: u8 = 145;