diff options
Diffstat (limited to 'src/init.cpp')
-rw-r--r-- | src/init.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp index ec6998b..9b02bd9 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -6,8 +6,17 @@ extern "C" void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *o) { const godot_gdnative_core_api_struct *api = o->api_struct; for (int i = 0; i < api->num_extensions; i++) { - if (api->extensions[i]->type == GDNATIVE_EXT_NET) { - WebRTCPeerNative::_net_api = (godot_gdnative_ext_net_api_struct *)api->extensions[i]; + + if (api->extensions[i]->type != GDNATIVE_EXT_NET) + continue; + + const godot_gdnative_ext_net_api_struct *net_api = (godot_gdnative_ext_net_api_struct *)api->extensions[i]; + + if (!net_api->next) + break; + + if (net_api->next->version.major == 3 && net_api->next->version.minor == 2) { + WebRTCPeerNative::_net_api = (const godot_gdnative_ext_net_3_2_api_struct *)net_api->next; } } |