diff options
Diffstat (limited to 'scene/main')
| -rw-r--r-- | scene/main/http_request.cpp | 4 | ||||
| -rw-r--r-- | scene/main/instance_placeholder.cpp | 4 | ||||
| -rw-r--r-- | scene/main/node.cpp | 16 | ||||
| -rw-r--r-- | scene/main/scene_tree.cpp | 24 | ||||
| -rw-r--r-- | scene/main/scene_tree.h | 20 | ||||
| -rw-r--r-- | scene/main/timer.cpp | 8 | ||||
| -rw-r--r-- | scene/main/timer.h | 10 | ||||
| -rw-r--r-- | scene/main/viewport.cpp | 2 | ||||
| -rw-r--r-- | scene/main/window.cpp | 2 |
9 files changed, 45 insertions, 45 deletions
diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 588d4b67d5..2c6cefa771 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -220,7 +220,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) { client->get_response_headers(&rheaders); response_headers.resize(0); downloaded.set(0); - for (String &E : rheaders) { + for (const String &E : rheaders) { response_headers.push_back(E); } @@ -235,7 +235,7 @@ bool HTTPRequest::_handle_response(bool *ret_value) { String new_request; - for (String &E : rheaders) { + for (const String &E : rheaders) { if (E.findn("Location: ") != -1) { new_request = E.substr(9, E.length()).strip_edges(); } diff --git a/scene/main/instance_placeholder.cpp b/scene/main/instance_placeholder.cpp index b7c6723cfc..b5ba1899ec 100644 --- a/scene/main/instance_placeholder.cpp +++ b/scene/main/instance_placeholder.cpp @@ -95,7 +95,7 @@ Node *InstancePlaceholder::create_instance(bool p_replace, const Ref<PackedScene scene->set_name(get_name()); int pos = get_index(); - for (PropSet &E : stored_values) { + for (const PropSet &E : stored_values) { scene->set(E.name, E.value); } @@ -114,7 +114,7 @@ Dictionary InstancePlaceholder::get_stored_values(bool p_with_order) { Dictionary ret; PackedStringArray order; - for (PropSet &E : stored_values) { + for (const PropSet &E : stored_values) { ret[E.name] = E.value; if (p_with_order) { order.push_back(E.name); diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 4b496d4761..f1e5574351 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1597,7 +1597,7 @@ Array Node::_get_groups() const { Array groups; List<GroupInfo> gi; get_groups(&gi); - for (GroupInfo &E : gi) { + for (const GroupInfo &E : gi) { groups.push_back(E.name); } @@ -1947,7 +1947,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const List<PropertyInfo> plist; N->get()->get_property_list(&plist); - for (PropertyInfo &E : plist) { + for (const PropertyInfo &E : plist) { if (!(E.usage & PROPERTY_USAGE_STORAGE)) { continue; } @@ -1983,7 +1983,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const if (p_flags & DUPLICATE_GROUPS) { List<GroupInfo> gi; get_groups(&gi); - for (GroupInfo &E : gi) { + for (const GroupInfo &E : gi) { #ifdef TOOLS_ENABLED if ((p_flags & DUPLICATE_FROM_EDITOR) && !E.persistent) { continue; @@ -2073,7 +2073,7 @@ void Node::remap_node_resources(Node *p_node, const Map<RES, RES> &p_resource_re List<PropertyInfo> props; p_node->get_property_list(&props); - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { if (!(E.usage & PROPERTY_USAGE_STORAGE)) { continue; } @@ -2099,7 +2099,7 @@ void Node::remap_nested_resources(RES p_resource, const Map<RES, RES> &p_resourc List<PropertyInfo> props; p_resource->get_property_list(&props); - for (PropertyInfo &E : props) { + for (const PropertyInfo &E : props) { if (!(E.usage & PROPERTY_USAGE_STORAGE)) { continue; } @@ -2135,7 +2135,7 @@ void Node::_duplicate_signals(const Node *p_original, Node *p_copy) const { List<Connection> conns; n->get_all_signal_connections(&conns); - for (Connection &E : conns) { + for (const Connection &E : conns) { if (E.flags & CONNECT_PERSIST) { //user connected NodePath p = p_original->get_path_to(n); @@ -2194,7 +2194,7 @@ void Node::replace_by(Node *p_node, bool p_keep_groups) { List<GroupInfo> groups; get_groups(&groups); - for (GroupInfo &E : groups) { + for (const GroupInfo &E : groups) { p_node->add_to_group(E.name, E.persistent); } } @@ -2241,7 +2241,7 @@ void Node::_replace_connections_target(Node *p_new_target) { List<Connection> cl; get_signals_connected_to_this(&cl); - for (Connection &c : cl) { + for (const Connection &c : cl) { if (c.flags & CONNECT_PERSIST) { c.signal.get_object()->disconnect(c.signal.get_name(), Callable(this, c.callable.get_method())); bool valid = p_new_target->has_method(c.callable.get_method()) || Ref<Script>(p_new_target->get_script()).is_null() || Ref<Script>(p_new_target->get_script())->has_method(c.callable.get_method()); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 8bca76a794..dcbbebbc55 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -66,11 +66,11 @@ void SceneTreeTimer::_bind_methods() { ADD_SIGNAL(MethodInfo("timeout")); } -void SceneTreeTimer::set_time_left(float p_time) { +void SceneTreeTimer::set_time_left(double p_time) { time_left = p_time; } -float SceneTreeTimer::get_time_left() const { +double SceneTreeTimer::get_time_left() const { return time_left; } @@ -94,7 +94,7 @@ void SceneTreeTimer::release_connections() { List<Connection> connections; get_all_signal_connections(&connections); - for (Connection &connection : connections) { + for (const Connection &connection : connections) { disconnect(connection.signal.get_name(), connection.callable); } } @@ -403,7 +403,7 @@ void SceneTree::initialize() { MainLoop::initialize(); } -bool SceneTree::physics_process(float p_time) { +bool SceneTree::physics_process(double p_time) { root_lock++; current_frame++; @@ -432,7 +432,7 @@ bool SceneTree::physics_process(float p_time) { return _quit; } -bool SceneTree::process(float p_time) { +bool SceneTree::process(double p_time) { root_lock++; MainLoop::process(p_time); @@ -474,7 +474,7 @@ bool SceneTree::process(float p_time) { continue; } - float time_left = E->get()->get_time_left(); + double time_left = E->get()->get_time_left(); if (E->get()->is_ignore_time_scale()) { time_left -= Engine::get_singleton()->get_process_step(); } else { @@ -571,8 +571,8 @@ void SceneTree::finalize() { } // cleanup timers - for (Ref<SceneTreeTimer> E : timers) { - E->release_connections(); + for (Ref<SceneTreeTimer> &timer : timers) { + timer->release_connections(); } timers.clear(); } @@ -1124,7 +1124,7 @@ void SceneTree::add_current_scene(Node *p_current) { root->add_child(p_current); } -Ref<SceneTreeTimer> SceneTree::create_timer(float p_delay_sec, bool p_process_always) { +Ref<SceneTreeTimer> SceneTree::create_timer(double p_delay_sec, bool p_process_always) { Ref<SceneTreeTimer> stt; stt.instantiate(); stt->set_process_always(p_process_always); @@ -1146,8 +1146,8 @@ Array SceneTree::get_processed_tweens() { ret.resize(tweens.size()); int i = 0; - for (Ref<Tween> E : tweens) { - ret[i] = E; + for (const Ref<Tween> &tween : tweens) { + ret[i] = tween; i++; } @@ -1402,7 +1402,7 @@ SceneTree::SceneTree() { List<String> exts; ResourceLoader::get_recognized_extensions_for_type("Environment", &exts); String ext_hint; - for (String &E : exts) { + for (const String &E : exts) { if (ext_hint != String()) { ext_hint += ","; } diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h index c3d59663d6..cfb95bd6b5 100644 --- a/scene/main/scene_tree.h +++ b/scene/main/scene_tree.h @@ -52,7 +52,7 @@ class Tween; class SceneTreeTimer : public RefCounted { GDCLASS(SceneTreeTimer, RefCounted); - float time_left = 0.0; + double time_left = 0.0; bool process_always = true; bool ignore_time_scale = false; @@ -60,8 +60,8 @@ protected: static void _bind_methods(); public: - void set_time_left(float p_time); - float get_time_left() const; + void set_time_left(double p_time); + double get_time_left() const; void set_process_always(bool p_process_always); bool is_process_always(); @@ -91,8 +91,8 @@ private: Window *root = nullptr; uint64_t tree_version = 1; - float physics_process_time = 1.0; - float process_time = 1.0; + double physics_process_time = 1.0; + double process_time = 1.0; bool accept_quit = true; bool quit_on_go_back = true; @@ -237,8 +237,8 @@ public: virtual void initialize() override; - virtual bool physics_process(float p_time) override; - virtual bool process(float p_time) override; + virtual bool physics_process(double p_time) override; + virtual bool process(double p_time) override; virtual void finalize() override; @@ -247,8 +247,8 @@ public: 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; } + _FORCE_INLINE_ double get_physics_process_time() const { return physics_process_time; } + _FORCE_INLINE_ double get_process_time() const { return process_time; } #ifdef TOOLS_ENABLED bool is_node_being_edited(const Node *p_node) const; @@ -317,7 +317,7 @@ public: Error change_scene_to(const Ref<PackedScene> &p_scene); Error reload_current_scene(); - Ref<SceneTreeTimer> create_timer(float p_delay_sec, bool p_process_always = true); + Ref<SceneTreeTimer> create_timer(double p_delay_sec, bool p_process_always = true); Ref<Tween> create_tween(); Array get_processed_tweens(); diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp index ef8245076f..b5a2a30b3b 100644 --- a/scene/main/timer.cpp +++ b/scene/main/timer.cpp @@ -81,12 +81,12 @@ void Timer::_notification(int p_what) { } } -void Timer::set_wait_time(float p_time) { +void Timer::set_wait_time(double p_time) { ERR_FAIL_COND_MSG(p_time <= 0, "Time should be greater than zero."); wait_time = p_time; } -float Timer::get_wait_time() const { +double Timer::get_wait_time() const { return wait_time; } @@ -106,7 +106,7 @@ bool Timer::has_autostart() const { return autostart; } -void Timer::start(float p_time) { +void Timer::start(double p_time) { ERR_FAIL_COND_MSG(!is_inside_tree(), "Timer was not added to the SceneTree. Either add it or set autostart to true."); if (p_time > 0) { @@ -139,7 +139,7 @@ bool Timer::is_stopped() const { return get_time_left() <= 0; } -float Timer::get_time_left() const { +double Timer::get_time_left() const { return time_left > 0 ? time_left : 0; } diff --git a/scene/main/timer.h b/scene/main/timer.h index 3d9e21d7fc..2b9faddcb9 100644 --- a/scene/main/timer.h +++ b/scene/main/timer.h @@ -36,7 +36,7 @@ class Timer : public Node { GDCLASS(Timer, Node); - float wait_time = 1.0; + double wait_time = 1.0; bool one_shot = false; bool autostart = false; bool processing = false; @@ -54,8 +54,8 @@ public: TIMER_PROCESS_IDLE, }; - void set_wait_time(float p_time); - float get_wait_time() const; + void set_wait_time(double p_time); + double get_wait_time() const; void set_one_shot(bool p_one_shot); bool is_one_shot() const; @@ -63,7 +63,7 @@ public: void set_autostart(bool p_start); bool has_autostart() const; - void start(float p_time = -1); + void start(double p_time = -1); void stop(); void set_paused(bool p_paused); @@ -71,7 +71,7 @@ public: bool is_stopped() const; - float get_time_left() const; + double get_time_left() const; void set_timer_process_callback(TimerProcessCallback p_callback); TimerProcessCallback get_timer_process_callback() const; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 4231072ed9..27e42db1bd 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -573,7 +573,7 @@ void Viewport::_process_picking() { // if no mouse event exists, create a motion one. This is necessary because objects or camera may have moved. // while this extra event is sent, it is checked if both camera and last object and last ID did not move. If nothing changed, the event is discarded to avoid flooding with unnecessary motion events every frame bool has_mouse_event = false; - for (Ref<InputEvent> m : physics_picking_events) { + for (const Ref<InputEvent> &m : physics_picking_events) { if (m.is_valid()) { has_mouse_event = true; break; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 4ebfe301ab..ab1846660b 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1356,7 +1356,7 @@ void Window::_validate_property(PropertyInfo &property) const { Vector<StringName> unique_names; String hint_string; - for (StringName &E : names) { + for (const StringName &E : names) { // Skip duplicate values. if (unique_names.has(E)) { continue; |