Remove lifetime mess, replace a lot of code with Arc instead of borrows.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This cleans up the codebase massively, and allows me to maintain some semblance of sanity.
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
use std::any::Any;
|
||||
use std::mem::{align_of, size_of};
|
||||
use std::sync::atomic::{AtomicBool, AtomicPtr, AtomicUsize};
|
||||
use std::sync::{Arc, Weak};
|
||||
|
||||
use hashbrown::HashSet;
|
||||
use wasmer::NativeFunc;
|
||||
|
||||
use crate::dynamic_data::{DynamicLibrary, Pokemon, Script, TurnChoice};
|
||||
use crate::dynamic_data::{DynamicLibrary, Script, TurnChoice};
|
||||
use crate::script_implementations::wasm::extern_ref::{ExternRef, VecExternRef};
|
||||
use crate::script_implementations::wasm::script_resolver::WebAssemblyEnvironmentData;
|
||||
use crate::script_implementations::wasm::WebAssemblyScriptCapabilities;
|
||||
@@ -92,8 +91,7 @@ impl Script for WebAssemblyScript {
|
||||
let env = self.environment.upgrade().unwrap();
|
||||
let func = env.script_function_cache().on_before_turn(&env);
|
||||
if let Some(func) = func {
|
||||
func.call(self.self_ptr, ExternRef::new(env.as_ref(), choice).index())
|
||||
.unwrap();
|
||||
func.call(self.self_ptr, ExternRef::new(env.as_ref(), choice)).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user