diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-02-16 20:58:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-16 20:58:55 +0100 |
commit | 009254d87c1de573d2abeb273676f22d0bdfc67f (patch) | |
tree | 6123649c85c0a6d513224901de8a25bc068c4901 /modules/gdnative/nativescript/nativescript.cpp | |
parent | 5d5f80b5295479ca4e12989394b3a2af8819a1ee (diff) | |
parent | 6553f5c242865f9aadbe2fdab6db6876c44ac472 (diff) | |
download | redot-engine-009254d87c1de573d2abeb273676f22d0bdfc67f.tar.gz |
Merge pull request #58187 from jakobbouchard/notification-switch-chunk-c
Convert _notification methods to switch - Chunk C
Diffstat (limited to 'modules/gdnative/nativescript/nativescript.cpp')
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 5d5414c694..95976a8827 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -763,17 +763,19 @@ Variant NativeScriptInstance::call(const StringName &p_method, const Variant **p return Variant(); } -void NativeScriptInstance::notification(int p_notification) { +void NativeScriptInstance::notification(int p_what) { #ifdef DEBUG_ENABLED - if (p_notification == MainLoop::NOTIFICATION_CRASH) { - if (current_method_call != StringName()) { - ERR_PRINT("NativeScriptInstance detected crash on method: " + current_method_call); - current_method_call = ""; - } + switch (p_what) { + case MainLoop::NOTIFICATION_CRASH: { + if (current_method_call != StringName()) { + ERR_PRINT("NativeScriptInstance detected crash on method: " + current_method_call); + current_method_call = ""; + } + } break; } #endif - Variant value = p_notification; + Variant value = p_what; const Variant *args[1] = { &value }; Callable::CallError error; call("_notification", args, 1, error); @@ -1639,7 +1641,6 @@ void NativeReloadNode::_bind_methods() { void NativeReloadNode::_notification(int p_what) { #ifdef TOOLS_ENABLED - switch (p_what) { case NOTIFICATION_APPLICATION_FOCUS_OUT: { if (unloaded) { @@ -1672,7 +1673,6 @@ void NativeReloadNode::_notification(int p_what) { } unloaded = true; - } break; case NOTIFICATION_APPLICATION_FOCUS_IN: { @@ -1736,10 +1736,7 @@ void NativeReloadNode::_notification(int p_what) { for (Set<StringName>::Element *R = libs_to_remove.front(); R; R = R->next()) { NSL->library_gdnatives.erase(R->get()); } - } break; - default: { - }; } #endif } |