make these a bit more public for tests
This commit is contained in:
parent
55f82b9fce
commit
70a6764360
@ -173,10 +173,16 @@ impl RoomFloorItems {
|
||||
self.0.push(item);
|
||||
}
|
||||
|
||||
pub fn remove_item(&mut self, item_id: &ClientItemId) {
|
||||
self.0.retain(|item| item.item_id() != *item_id);
|
||||
}
|
||||
|
||||
// TODO: &ClientItemId
|
||||
pub fn get_item_by_id(&self, item_id: ClientItemId) -> Option<&FloorItem> {
|
||||
self.0.iter().find(|item| item.item_id() == item_id)
|
||||
}
|
||||
|
||||
// TODO: &ClientItemId
|
||||
pub fn get_item_handle_by_id(&mut self, item_id: ClientItemId) -> Option<FloorItemHandle> {
|
||||
let index = self.0.iter().position(|item| item.item_id() == item_id)?;
|
||||
Some(FloorItemHandle {
|
||||
|
@ -58,16 +58,16 @@ pub enum ItemManagerError {
|
||||
}
|
||||
|
||||
pub struct ItemManager {
|
||||
id_counter: u32,
|
||||
pub(super) id_counter: u32,
|
||||
|
||||
character_inventory: HashMap<CharacterEntityId, CharacterInventory>,
|
||||
pub(self) character_inventory: HashMap<CharacterEntityId, CharacterInventory>,
|
||||
//character_bank: HashMap<CharacterEntityId, BTreeMap<BankName, CharacterBank>>,
|
||||
character_bank: HashMap<CharacterEntityId, CharacterBank>,
|
||||
character_floor: HashMap<CharacterEntityId, RoomFloorItems>,
|
||||
pub(self) character_bank: HashMap<CharacterEntityId, CharacterBank>,
|
||||
pub(self) character_floor: HashMap<CharacterEntityId, RoomFloorItems>,
|
||||
|
||||
character_room: HashMap<CharacterEntityId, RoomId>,
|
||||
room_floor: HashMap<RoomId, RoomFloorItems>,
|
||||
room_item_id_counter: HashMap<RoomId, Box<dyn FnMut() -> ClientItemId + Send>>,
|
||||
pub(self) character_room: HashMap<CharacterEntityId, RoomId>,
|
||||
pub(self) room_floor: HashMap<RoomId, RoomFloorItems>,
|
||||
pub(self) room_item_id_counter: HashMap<RoomId, Box<dyn FnMut() -> ClientItemId + Send>>,
|
||||
}
|
||||
|
||||
impl Default for ItemManager {
|
||||
|
Loading…
x
Reference in New Issue
Block a user