Major work on WASM results
This commit is contained in:
@@ -19,7 +19,7 @@ extern "C" fn battle_new(
|
||||
// NOTE: Split into two due to u128 not being ABI safe: https://github.com/rust-lang/rust/issues/54341
|
||||
random_seed_1: u64,
|
||||
random_seed_2: u64,
|
||||
) -> IdentifiablePointer<Battle> {
|
||||
) -> IdentifiablePointer<Arc<Battle>> {
|
||||
let parties = unsafe {
|
||||
std::slice::from_raw_parts(parties, parties_length)
|
||||
.iter()
|
||||
@@ -34,14 +34,14 @@ extern "C" fn battle_new(
|
||||
};
|
||||
let random_seed = if random_seed == 0 { None } else { Some(random_seed) };
|
||||
|
||||
Box::new(Battle::new(
|
||||
Battle::new(
|
||||
library.as_ref().clone(),
|
||||
parties,
|
||||
can_flee == 1,
|
||||
number_of_sides,
|
||||
pokemon_per_side,
|
||||
random_seed,
|
||||
))
|
||||
)
|
||||
.into()
|
||||
}
|
||||
|
||||
|
||||
@@ -251,9 +251,9 @@ extern "C" fn pokemon_set_effort_value(
|
||||
/// Gets the data for the battle the Pokemon is currently in. If the Pokemon is not in a battle, this
|
||||
/// returns null.
|
||||
#[no_mangle]
|
||||
extern "C" fn pokemon_get_battle(ptr: ExternPointer<Arc<Pokemon>>) -> IdentifiablePointer<Battle> {
|
||||
extern "C" fn pokemon_get_battle(ptr: ExternPointer<Arc<Pokemon>>) -> IdentifiablePointer<Arc<Battle>> {
|
||||
if let Some(v) = ptr.as_ref().get_battle() {
|
||||
(v as *const Battle).into()
|
||||
v.into()
|
||||
} else {
|
||||
IdentifiablePointer::none()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user