This commit is contained in:
@@ -8,12 +8,12 @@ use crate::{StringKey, ValueIdentifiable, ValueIdentifier};
|
||||
|
||||
/// A library to store all items.
|
||||
#[derive(Debug)]
|
||||
#[cfg_attr(feature = "wasm", derive(unique_type_id_derive::UniqueTypeId))]
|
||||
|
||||
pub struct ItemLibrary {
|
||||
/// A unique identifier so we know what value this is.
|
||||
identifier: ValueIdentifier,
|
||||
/// The underlying data structure.
|
||||
map: IndexMap<StringKey, Arc<Item>>,
|
||||
map: IndexMap<StringKey, Arc<dyn Item>>,
|
||||
}
|
||||
|
||||
impl ItemLibrary {
|
||||
@@ -26,12 +26,12 @@ impl ItemLibrary {
|
||||
}
|
||||
}
|
||||
|
||||
impl DataLibrary<'_, Item> for ItemLibrary {
|
||||
fn map(&self) -> &IndexMap<StringKey, Arc<Item>> {
|
||||
impl DataLibrary<dyn Item> for ItemLibrary {
|
||||
fn map(&self) -> &IndexMap<StringKey, Arc<dyn Item>> {
|
||||
&self.map
|
||||
}
|
||||
|
||||
fn get_modify(&mut self) -> &mut IndexMap<StringKey, Arc<Item>> {
|
||||
fn get_modify(&mut self) -> &mut IndexMap<StringKey, Arc<dyn Item>> {
|
||||
&mut self.map
|
||||
}
|
||||
}
|
||||
@@ -49,11 +49,11 @@ pub mod tests {
|
||||
|
||||
use crate::static_data::libraries::data_library::DataLibrary;
|
||||
use crate::static_data::libraries::item_library::ItemLibrary;
|
||||
use crate::static_data::Item;
|
||||
use crate::static_data::ItemImpl;
|
||||
use crate::static_data::{BattleItemCategory, ItemCategory};
|
||||
|
||||
fn build_item() -> Item {
|
||||
Item::new(
|
||||
fn build_item() -> ItemImpl {
|
||||
ItemImpl::new(
|
||||
&"foo".into(),
|
||||
ItemCategory::MiscItem,
|
||||
BattleItemCategory::MiscBattleItem,
|
||||
|
||||
Reference in New Issue
Block a user