Skip to content

Commit 02f2b1d

Browse files
committed
MSVC compatible PoolArray search
Fix conversion warning
1 parent f8473e9 commit 02f2b1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/defs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Useful for minimizing changes to implementation files between targets e.g. GDExt
3535
#define PRINT(message) Godot::print(String(message))
3636
#define PRINT_ERROR(message) Godot::print_error("Godot Wasm: " + String(message), __func__, __FILE__, __LINE__)
3737
#define ObjectID int64_t
38-
#define INSTANCE_FROM_ID(id) godot::core_1_2_api->godot_instance_from_id(id) == nullptr ? nullptr : godot::detail::get_wrapper<Object>(godot::core_1_2_api->godot_instance_from_id(id))
38+
#define INSTANCE_FROM_ID(id) godot::core_1_2_api->godot_instance_from_id((godot_int)id) == nullptr ? nullptr : godot::detail::get_wrapper<Object>(godot::core_1_2_api->godot_instance_from_id(id))
3939
#define INSTANCE_VALIDATE(id) godot::core_1_1_api->godot_is_instance_valid((godot_object*)id)
4040
#define GDCLASS GODOT_CLASS
4141
#define REGISTRATION_METHOD _register_methods
@@ -50,7 +50,7 @@ Useful for minimizing changes to implementation files between targets e.g. GDExt
5050
#define FAIL_IF(cond, message, ret) if (unlikely(cond)) FAIL(message, ret)
5151
#define INSTANTIATE_REF(ref) ref.instance()
5252
#define BYTE_ARRAY_POINTER(array) array.read().ptr()
53-
#define PACKED_ARRAY_HAS(array, value) ({ bool f = false; for (int i = 0; i < array.size(); i++) { if (array[i] == value) { f = true; break; } } f; })
53+
#define PACKED_ARRAY_HAS(array, value) [&]() { for (int i = 0; i < array.size(); i++) { if (array[i] == value) return true; } return false; }()
5454
#define CMDLINE_ARGS PoolStringArray() // User CLI args unsupported in Godot 3
5555
#define TIME_REALTIME OS::get_singleton()->get_system_time_msecs() * 1000000
5656
#define TIME_MONOTONIC OS::get_singleton()->get_ticks_usec() * 1000

0 commit comments

Comments
 (0)