Make MoveData a trait
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-11-27 22:29:11 +01:00
parent 27164616e9
commit ad9f17ccf1
12 changed files with 118 additions and 81 deletions

View File

@@ -7,7 +7,7 @@ use std::sync::Arc;
/// Instantiate a new learned move.
#[no_mangle]
extern "C" fn learned_move_new(
move_data: ExternPointer<Arc<MoveData>>,
move_data: ExternPointer<Arc<dyn MoveData>>,
learn_method: MoveLearnMethod,
) -> IdentifiablePointer<Arc<LearnedMove>> {
Arc::new(LearnedMove::new(move_data.as_ref(), learn_method)).into()
@@ -23,7 +23,7 @@ extern "C" fn learned_move_drop(learned_move: OwnedPtr<Arc<LearnedMove>>) {
#[no_mangle]
extern "C" fn learned_move_move_data(
learned_move: ExternPointer<Arc<LearnedMove>>,
) -> IdentifiablePointer<Arc<MoveData>> {
) -> IdentifiablePointer<Arc<dyn MoveData>> {
learned_move.as_ref().move_data().clone().into()
}