summaryrefslogtreecommitdiff
path: root/modules/gdnative/nativescript/nativescript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdnative/nativescript/nativescript.cpp')
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index f3a0e9603f..92ba9bd452 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -114,9 +114,25 @@ void NativeScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder)
#endif
bool NativeScript::inherits_script(const Ref<Script> &p_script) const {
-#ifndef _MSC_VER
-#warning inheritance needs to be implemented in NativeScript
-#endif
+ Ref<NativeScript> ns = p_script;
+ if (ns.is_null()) {
+ return false;
+ }
+
+ const NativeScriptDesc *other_s = ns->get_script_desc();
+ if (!other_s) {
+ return false;
+ }
+
+ const NativeScriptDesc *s = get_script_desc();
+
+ while (s) {
+ if (s == other_s) {
+ return true;
+ }
+ s = s->base_data;
+ }
+
return false;
}
@@ -415,9 +431,9 @@ void NativeScript::get_script_property_list(List<PropertyInfo> *p_list) const {
}
}
-const Vector<MultiplayerAPI::RPCConfig> NativeScript::get_rpc_methods() const {
+const Vector<Multiplayer::RPCConfig> NativeScript::get_rpc_methods() const {
NativeScriptDesc *script_data = get_script_desc();
- ERR_FAIL_COND_V(!script_data, Vector<MultiplayerAPI::RPCConfig>());
+ ERR_FAIL_COND_V(!script_data, Vector<Multiplayer::RPCConfig>());
return script_data->rpc_methods;
}
@@ -812,7 +828,7 @@ Ref<Script> NativeScriptInstance::get_script() const {
return script;
}
-const Vector<MultiplayerAPI::RPCConfig> NativeScriptInstance::get_rpc_methods() const {
+const Vector<Multiplayer::RPCConfig> NativeScriptInstance::get_rpc_methods() const {
return script->get_rpc_methods();
}