Minor changes and fixes
This commit is contained in:
		| @@ -51,6 +51,7 @@ impl Battle { | ||||
|         unsafe { battle_get_pokemon(self.inner.reference, side, index).get_value() } | ||||
|     } | ||||
|  | ||||
|     #[cfg(not(feature = "mock_data"))] | ||||
|     pub fn find_party_for_pokemon(&self, pokemon: &Pokemon) -> Option<BattleParty> { | ||||
|         unsafe { | ||||
|             battle_find_party_for_pokemon(self.inner.reference, pokemon.reference()).get_value() | ||||
|   | ||||
| @@ -23,6 +23,7 @@ impl ExternalReferenceType for ChoiceQueue { | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(not(feature = "mock_data"))] | ||||
| extern "wasm" { | ||||
|     fn choice_queue_move_pokemon_choice_next( | ||||
|         r: ExternRef<ChoiceQueue>, | ||||
|   | ||||
| @@ -126,6 +126,7 @@ impl ExternalReferenceType for HitData { | ||||
|     } | ||||
| } | ||||
|  | ||||
| #[cfg(not(feature = "mock_data"))] | ||||
| extern "wasm" { | ||||
|     fn executing_move_get_number_of_targets(r: ExternRef<ExecutingMove>) -> usize; | ||||
|     fn executing_move_get_number_of_hits(r: ExternRef<ExecutingMove>) -> u8; | ||||
|   | ||||
| @@ -36,12 +36,12 @@ impl DataLibrary<Item> for ItemLibrary { | ||||
|  | ||||
|     #[cfg(not(feature = "mock_data"))] | ||||
|     fn _get_ref_by_name(ptr: ExternRef<Self>, name: ExternRef<StringKey>) -> ExternRef<Item> { | ||||
|         unsafe { move_library_get_move(ptr, name) } | ||||
|         unsafe { item_library_get_item(ptr, name) } | ||||
|     } | ||||
|  | ||||
|     #[cfg(not(feature = "mock_data"))] | ||||
|     fn _get_ref_by_hash(ptr: ExternRef<Self>, hash: u32) -> ExternRef<Item> { | ||||
|         unsafe { move_library_get_move_by_hash(ptr, hash) } | ||||
|         unsafe { item_library_get_item_by_hash(ptr, hash) } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @@ -56,11 +56,11 @@ impl ExternalReferenceType for ItemLibrary { | ||||
|  | ||||
| #[cfg(not(feature = "mock_data"))] | ||||
| extern "wasm" { | ||||
|     fn move_library_get_move( | ||||
|     fn item_library_get_item( | ||||
|         ptr: ExternRef<ItemLibrary>, | ||||
|         name: ExternRef<StringKey>, | ||||
|     ) -> ExternRef<Item>; | ||||
|     fn move_library_get_move_by_hash(ptr: ExternRef<ItemLibrary>, hash: u32) -> ExternRef<Item>; | ||||
|     fn item_library_get_item_by_hash(ptr: ExternRef<ItemLibrary>, hash: u32) -> ExternRef<Item>; | ||||
| } | ||||
|  | ||||
| #[cfg(feature = "mock_data")] | ||||
|   | ||||
| @@ -10,7 +10,7 @@ pub mod type_library; | ||||
|  | ||||
| use crate::app_interface::species_library::SpeciesLibrary; | ||||
| use crate::app_interface::type_library::TypeLibrary; | ||||
| use crate::app_interface::LevelInt; | ||||
| use crate::app_interface::{get_hash, LevelInt}; | ||||
| use crate::handling::cached_value::CachedValue; | ||||
| use crate::handling::Cacheable; | ||||
| pub use item_library::*; | ||||
| @@ -179,6 +179,13 @@ where | ||||
|         v | ||||
|     } | ||||
|  | ||||
|     fn get_by_str(&self, name: &str) -> Option<T> | ||||
|     where | ||||
|         Self: Sized, | ||||
|     { | ||||
|         self.get_by_hash(get_hash(name)) | ||||
|     } | ||||
|  | ||||
|     fn get_by_hash(&self, hash: u32) -> Option<T> | ||||
|     where | ||||
|         Self: Sized, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user