diff --git a/src/ship/items/manager.rs b/src/ship/items/manager.rs index 084dd19..dcf9c86 100644 --- a/src/ship/items/manager.rs +++ b/src/ship/items/manager.rs @@ -986,37 +986,6 @@ impl ItemManager { item_ids: [u32; 30]) -> Result<(), ItemManagerError> { let inventory = self.character_inventory.get_mut(&character.id).ok_or(ItemManagerError::NoCharacter(character.id))?; - - let sorted_inventory_items: Vec<(usize, &InventoryItem)> = item_ids.iter() - .filter(|&client_item_id| *client_item_id < 0xFFFFFFFF) - .enumerate() - .map(|(slot, &client_item_id)| (slot, inventory.get_item_by_id(ClientItemId(client_item_id)).unwrap())) - .collect(); - println!("sorted_inventory_items: {:?}", sorted_inventory_items); - - // wait how is this different than update_inventory_slots() ??? - for (slot, item) in sorted_inventory_items { - match item { - InventoryItem::Individual(i) => { - entity_gateway.change_item_location(&i.entity_id, ItemLocation::Inventory { - character_id: character.id, - slot: slot, - equipped: i.equipped, - }).await - }, - InventoryItem::Stacked(s) => { - for entity_id in s.entity_ids.iter() { - entity_gateway.change_item_location(&entity_id, ItemLocation::Inventory { - character_id: character.id, - slot: slot, - equipped: false, - }).await - } - }, - }; - } - - /* let sorted_inventory_items: Vec = item_ids.iter() .filter(|&client_item_id| *client_item_id < 0xFFFFFFFF) .map(|&client_item_id| inventory.get_item_by_id(ClientItemId(client_item_id)).cloned().unwrap()) @@ -1024,7 +993,6 @@ impl ItemManager { let sorted_inventory = CharacterInventory::new(sorted_inventory_items); update_inventory_slots(entity_gateway, character, &sorted_inventory).await; - */ Ok(()) } } diff --git a/tests/test_item_equip.rs b/tests/test_item_actions.rs similarity index 98% rename from tests/test_item_equip.rs rename to tests/test_item_actions.rs index 1e22d2d..ae57d52 100644 --- a/tests/test_item_equip.rs +++ b/tests/test_item_actions.rs @@ -278,6 +278,7 @@ async fn test_sort_items() { create_room(&mut ship, ClientId(1), "room", "").await; let old_items = entity_gateway.get_items_by_character(&char1).await; + assert!(old_items[0].item.item_type() == item::ItemType::Armor(item::armor::ArmorType::Frame)); assert!(old_items[0].location == item::ItemLocation::Inventory{ character_id: char1.id, slot: 0,