Complete refactor of the FFI to use handles instead of pointers.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -2,14 +2,11 @@ use std::sync::atomic::{AtomicU8, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::static_data::MoveData;
|
||||
use crate::{ValueIdentifiable, ValueIdentifier};
|
||||
|
||||
/// A learned move is the data attached to a Pokemon for a move it has learned. It has information
|
||||
/// such as the remaining amount of users, how it has been learned, etc.
|
||||
#[derive(Debug)]
|
||||
pub struct LearnedMove {
|
||||
/// A unique identifier so we know what value this is.
|
||||
identifier: ValueIdentifier,
|
||||
/// The immutable move information of the move.
|
||||
move_data: Arc<dyn MoveData>,
|
||||
/// The maximal power points for this move.
|
||||
@@ -36,7 +33,6 @@ impl LearnedMove {
|
||||
pub fn new(move_data: Arc<dyn MoveData>, learn_method: MoveLearnMethod) -> Self {
|
||||
let max_pp = move_data.base_usages();
|
||||
Self {
|
||||
identifier: Default::default(),
|
||||
move_data,
|
||||
max_pp,
|
||||
remaining_pp: AtomicU8::new(max_pp),
|
||||
@@ -92,12 +88,6 @@ impl LearnedMove {
|
||||
}
|
||||
}
|
||||
|
||||
impl ValueIdentifiable for LearnedMove {
|
||||
fn value_identifier(&self) -> ValueIdentifier {
|
||||
self.identifier
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::unwrap_used)]
|
||||
mod tests {
|
||||
|
||||
Reference in New Issue
Block a user