Rework of FFI, adding a value identifier, so we can keep knowledge of data even when data moves.
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:
@@ -4,13 +4,15 @@ use crate::static_data::Statistic;
|
||||
use crate::static_data::TypeIdentifier;
|
||||
use crate::static_data::{Ability, StaticStatisticSet};
|
||||
use crate::static_data::{AbilityIndex, LearnableMoves};
|
||||
use crate::Random;
|
||||
use crate::StringKey;
|
||||
use crate::{Random, ValueIdentifiable, ValueIdentifier};
|
||||
|
||||
/// A form is a variant of a specific species. A species always has at least one form, but can have
|
||||
/// many more.
|
||||
#[derive(Debug)]
|
||||
pub struct Form {
|
||||
/// A unique identifier so we know what value this is.
|
||||
identifier: ValueIdentifier,
|
||||
/// The name of the form.
|
||||
name: StringKey,
|
||||
/// The height of the form in meters.
|
||||
@@ -48,6 +50,7 @@ impl Form {
|
||||
flags: HashSet<StringKey>,
|
||||
) -> Form {
|
||||
Form {
|
||||
identifier: Default::default(),
|
||||
name: name.clone(),
|
||||
height,
|
||||
weight,
|
||||
@@ -156,3 +159,9 @@ impl Form {
|
||||
self.flags.contains(key)
|
||||
}
|
||||
}
|
||||
|
||||
impl ValueIdentifiable for Form {
|
||||
fn value_identifier(&self) -> ValueIdentifier {
|
||||
self.identifier
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user