diff options
author | Emmanuel Leblond <emmanuel.leblond@gmail.com> | 2020-06-04 22:03:45 +0200 |
---|---|---|
committer | Emmanuel Leblond <emmanuel.leblond@gmail.com> | 2021-02-25 18:34:50 +0100 |
commit | 60d2c1fd47a0c24a127ea00f09724537f5527dbb (patch) | |
tree | 6b92be637c408a92715bcec68950250dcf31790e /scene | |
parent | 0e4abcb77f6b5ce81824462706f8b2325bc3fed1 (diff) |
Remove GDScript bindings for OS.get/set_exit_code, SceneTree.quit(<exit_code>) should be used instead
Diffstat (limited to 'scene')
-rw-r--r-- | scene/main/scene_tree.cpp | 12 | ||||
-rw-r--r-- | scene/main/scene_tree.h | 2 |
2 files changed, 3 insertions, 11 deletions
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index c93306dec8..9aaddfd373 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -535,15 +535,7 @@ void SceneTree::finalize() { } void SceneTree::quit(int p_exit_code) { - if (p_exit_code >= 0) { - // Override the exit code if a positive argument is given (the default is `-1`). - // This is a shorthand for calling `set_exit_code()` on the OS singleton then quitting. - OS::get_singleton()->set_exit_code(p_exit_code); - } else if (!OS::get_singleton()->is_custom_exit_code()) { - // Must customize exit code, otherwise it will default to a non-zero value - OS::get_singleton()->set_exit_code(EXIT_SUCCESS); - } - + OS::get_singleton()->set_exit_code(p_exit_code); _quit = true; } @@ -1209,7 +1201,7 @@ void SceneTree::_bind_methods() { ClassDB::bind_method(D_METHOD("get_node_count"), &SceneTree::get_node_count); ClassDB::bind_method(D_METHOD("get_frame"), &SceneTree::get_frame); - ClassDB::bind_method(D_METHOD("quit", "exit_code"), &SceneTree::quit, DEFVAL(-1)); + ClassDB::bind_method(D_METHOD("quit", "exit_code"), &SceneTree::quit, DEFVAL(EXIT_SUCCESS)); ClassDB::bind_method(D_METHOD("queue_delete", "obj"), &SceneTree::queue_delete); diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index c2280c747b..a2f2adb8f8 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -245,7 +245,7 @@ public: void set_auto_accept_quit(bool p_enable); void set_quit_on_go_back(bool p_enable); - void quit(int p_exit_code = -1); + void quit(int p_exit_code = EXIT_SUCCESS); _FORCE_INLINE_ float get_physics_process_time() const { return physics_process_time; } _FORCE_INLINE_ float get_process_time() const { return process_time; } |