From 928159e6f6a73a249d5504ca6c136809b5ed07c0 Mon Sep 17 00:00:00 2001 From: Jovan Gerodetti Date: Mon, 18 Dec 2023 00:07:07 +0100 Subject: [PATCH] GDExtensionCallErrorType is i32 on windows... Part 2 (#16) --- rust-script/src/script_registry.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rust-script/src/script_registry.rs b/rust-script/src/script_registry.rs index a2b0a78..7eda3b4 100644 --- a/rust-script/src/script_registry.rs +++ b/rust-script/src/script_registry.rs @@ -54,6 +54,8 @@ where self.call(method.as_str().into(), &args) .map(RemoteValue::from) + // GDExtensionCallErrorType is not guaranteed to be a u32 + .map_err(godot_call_error_type_to_u32) .into() } @@ -378,3 +380,13 @@ impl<'a> RemoteValueRef<'a> { unsafe { &*(self.ptr as *const Variant) } } } + +#[cfg(not(target_os = "windows"))] +fn godot_call_error_type_to_u32(err: godot::sys::GDExtensionCallErrorType) -> u32 { + err +} + +#[cfg(target_os = "windows")] +fn godot_call_error_type_to_u32(err: godot::sys::GDExtensionCallErrorType) -> u32 { + err as u32 +}