diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-10-07 11:34:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-07 11:34:11 +0200 |
commit | 58ca3031419cacb35c530cebe68e87a4c27dde06 (patch) | |
tree | b0965bb65919bc1495ee02204a91e5ed3a9b56a7 /scene/main | |
parent | 5b7f62af55b7f322192f95258d825b163cbf9dc1 (diff) | |
parent | 0103af1ddda6a2aa31227965141dd7d3a513e081 (diff) |
Merge pull request #66808 from bruvzg/msvc_warn
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/multiplayer_api.cpp | 8 | ||||
-rw-r--r-- | scene/main/node.cpp | 12 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 92 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 26 | ||||
-rw-r--r-- | scene/main/window.cpp | 24 |
5 files changed, 78 insertions, 84 deletions
diff --git a/scene/main/multiplayer_api.cpp b/scene/main/multiplayer_api.cpp index 2d2103f031..7e2c82c88d 100644 --- a/scene/main/multiplayer_api.cpp +++ b/scene/main/multiplayer_api.cpp @@ -372,7 +372,7 @@ Error MultiplayerAPIExtension::rpcp(Object *p_obj, int p_peer_id, const StringNa for (int i = 0; i < p_argcount; i++) { args.push_back(*p_arg[i]); } - int ret; + int ret = FAILED; if (GDVIRTUAL_CALL(_rpc, p_peer_id, p_obj, p_method, args, ret)) { return (Error)ret; } @@ -380,7 +380,7 @@ Error MultiplayerAPIExtension::rpcp(Object *p_obj, int p_peer_id, const StringNa } int MultiplayerAPIExtension::get_remote_sender_id() { - int id; + int id = 0; if (GDVIRTUAL_CALL(_get_remote_sender_id, id)) { return id; } @@ -388,7 +388,7 @@ int MultiplayerAPIExtension::get_remote_sender_id() { } Error MultiplayerAPIExtension::object_configuration_add(Object *p_object, Variant p_config) { - int err; + int err = ERR_UNAVAILABLE; if (GDVIRTUAL_CALL(_object_configuration_add, p_object, p_config, err)) { return (Error)err; } @@ -396,7 +396,7 @@ Error MultiplayerAPIExtension::object_configuration_add(Object *p_object, Varian } Error MultiplayerAPIExtension::object_configuration_remove(Object *p_object, Variant p_config) { - int err; + int err = ERR_UNAVAILABLE; if (GDVIRTUAL_CALL(_object_configuration_remove, p_object, p_config, err)) { return (Error)err; } diff --git a/scene/main/node.cpp b/scene/main/node.cpp index bbdba16cb5..101a63db1b 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1411,14 +1411,14 @@ TypedArray<Node> Node::find_children(const String &p_pattern, const String &p_ty if (cptr[i]->is_class(p_type)) { ret.append(cptr[i]); } else if (cptr[i]->get_script_instance()) { - Ref<Script> script = cptr[i]->get_script_instance()->get_script(); - while (script.is_valid()) { - if ((ScriptServer::is_global_class(p_type) && ScriptServer::get_global_class_path(p_type) == script->get_path()) || p_type == script->get_path()) { + Ref<Script> scr = cptr[i]->get_script_instance()->get_script(); + while (scr.is_valid()) { + if ((ScriptServer::is_global_class(p_type) && ScriptServer::get_global_class_path(p_type) == scr->get_path()) || p_type == scr->get_path()) { ret.append(cptr[i]); break; } - script = script->get_base_script(); + scr = scr->get_base_script(); } } @@ -2121,9 +2121,9 @@ Node *Node::_duplicate(int p_flags, HashMap<const Node *, Node *> *r_duplimap) c if (p_flags & DUPLICATE_SCRIPTS) { bool is_valid = false; - Variant script = N->get()->get(script_property_name, &is_valid); + Variant scr = N->get()->get(script_property_name, &is_valid); if (is_valid) { - current_node->set(script_property_name, script); + current_node->set(script_property_name, scr); } } diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 3f71de1b18..af481749d5 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -105,10 +105,10 @@ bool SceneTreeTimer::is_ignore_time_scale() { } void SceneTreeTimer::release_connections() { - List<Connection> connections; - get_all_signal_connections(&connections); + List<Connection> signal_connections; + get_all_signal_connections(&signal_connections); - for (const Connection &connection : connections) { + for (const Connection &connection : signal_connections) { disconnect(connection.signal.get_name(), connection.callable); } } @@ -207,15 +207,15 @@ void SceneTree::_update_group_order(Group &g, bool p_use_priority) { return; } - Node **nodes = g.nodes.ptrw(); - int node_count = g.nodes.size(); + Node **gr_nodes = g.nodes.ptrw(); + int gr_node_count = g.nodes.size(); if (p_use_priority) { SortArray<Node *, Node::ComparatorWithPriority> node_sort; - node_sort.sort(nodes, node_count); + node_sort.sort(gr_nodes, gr_node_count); } else { SortArray<Node *, Node::Comparator> node_sort; - node_sort.sort(nodes, node_count); + node_sort.sort(gr_nodes, gr_node_count); } g.changed = false; } @@ -253,36 +253,36 @@ void SceneTree::call_group_flagsp(uint32_t p_call_flags, const StringName &p_gro _update_group_order(g); Vector<Node *> nodes_copy = g.nodes; - Node **nodes = nodes_copy.ptrw(); - int node_count = nodes_copy.size(); + Node **gr_nodes = nodes_copy.ptrw(); + int gr_node_count = nodes_copy.size(); call_lock++; if (p_call_flags & GROUP_CALL_REVERSE) { - for (int i = node_count - 1; i >= 0; i--) { - if (call_lock && call_skip.has(nodes[i])) { + for (int i = gr_node_count - 1; i >= 0; i--) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } if (!(p_call_flags & GROUP_CALL_DEFERRED)) { Callable::CallError ce; - nodes[i]->callp(p_function, p_args, p_argcount, ce); + gr_nodes[i]->callp(p_function, p_args, p_argcount, ce); } else { - MessageQueue::get_singleton()->push_callp(nodes[i], p_function, p_args, p_argcount); + MessageQueue::get_singleton()->push_callp(gr_nodes[i], p_function, p_args, p_argcount); } } } else { - for (int i = 0; i < node_count; i++) { - if (call_lock && call_skip.has(nodes[i])) { + for (int i = 0; i < gr_node_count; i++) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } if (!(p_call_flags & GROUP_CALL_DEFERRED)) { Callable::CallError ce; - nodes[i]->callp(p_function, p_args, p_argcount, ce); + gr_nodes[i]->callp(p_function, p_args, p_argcount, ce); } else { - MessageQueue::get_singleton()->push_callp(nodes[i], p_function, p_args, p_argcount); + MessageQueue::get_singleton()->push_callp(gr_nodes[i], p_function, p_args, p_argcount); } } } @@ -306,34 +306,34 @@ void SceneTree::notify_group_flags(uint32_t p_call_flags, const StringName &p_gr _update_group_order(g); Vector<Node *> nodes_copy = g.nodes; - Node **nodes = nodes_copy.ptrw(); - int node_count = nodes_copy.size(); + Node **gr_nodes = nodes_copy.ptrw(); + int gr_node_count = nodes_copy.size(); call_lock++; if (p_call_flags & GROUP_CALL_REVERSE) { - for (int i = node_count - 1; i >= 0; i--) { - if (call_lock && call_skip.has(nodes[i])) { + for (int i = gr_node_count - 1; i >= 0; i--) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } if (!(p_call_flags & GROUP_CALL_DEFERRED)) { - nodes[i]->notification(p_notification); + gr_nodes[i]->notification(p_notification); } else { - MessageQueue::get_singleton()->push_notification(nodes[i], p_notification); + MessageQueue::get_singleton()->push_notification(gr_nodes[i], p_notification); } } } else { - for (int i = 0; i < node_count; i++) { - if (call_lock && call_skip.has(nodes[i])) { + for (int i = 0; i < gr_node_count; i++) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } if (!(p_call_flags & GROUP_CALL_DEFERRED)) { - nodes[i]->notification(p_notification); + gr_nodes[i]->notification(p_notification); } else { - MessageQueue::get_singleton()->push_notification(nodes[i], p_notification); + MessageQueue::get_singleton()->push_notification(gr_nodes[i], p_notification); } } } @@ -357,34 +357,34 @@ void SceneTree::set_group_flags(uint32_t p_call_flags, const StringName &p_group _update_group_order(g); Vector<Node *> nodes_copy = g.nodes; - Node **nodes = nodes_copy.ptrw(); - int node_count = nodes_copy.size(); + Node **gr_nodes = nodes_copy.ptrw(); + int gr_node_count = nodes_copy.size(); call_lock++; if (p_call_flags & GROUP_CALL_REVERSE) { - for (int i = node_count - 1; i >= 0; i--) { - if (call_lock && call_skip.has(nodes[i])) { + for (int i = gr_node_count - 1; i >= 0; i--) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } if (!(p_call_flags & GROUP_CALL_DEFERRED)) { - nodes[i]->set(p_name, p_value); + gr_nodes[i]->set(p_name, p_value); } else { - MessageQueue::get_singleton()->push_set(nodes[i], p_name, p_value); + MessageQueue::get_singleton()->push_set(gr_nodes[i], p_name, p_value); } } } else { - for (int i = 0; i < node_count; i++) { - if (call_lock && call_skip.has(nodes[i])) { + for (int i = 0; i < gr_node_count; i++) { + if (call_lock && call_skip.has(gr_nodes[i])) { continue; } if (!(p_call_flags & GROUP_CALL_DEFERRED)) { - nodes[i]->set(p_name, p_value); + gr_nodes[i]->set(p_name, p_value); } else { - MessageQueue::get_singleton()->push_set(nodes[i], p_name, p_value); + MessageQueue::get_singleton()->push_set(gr_nodes[i], p_name, p_value); } } } @@ -846,13 +846,13 @@ void SceneTree::_notify_group_pause(const StringName &p_group, int p_notificatio //performance is not lost because only if something is added/removed the vector is copied. Vector<Node *> nodes_copy = g.nodes; - int node_count = nodes_copy.size(); - Node **nodes = nodes_copy.ptrw(); + int gr_node_count = nodes_copy.size(); + Node **gr_nodes = nodes_copy.ptrw(); call_lock++; - for (int i = 0; i < node_count; i++) { - Node *n = nodes[i]; + for (int i = 0; i < gr_node_count; i++) { + Node *n = gr_nodes[i]; if (call_lock && call_skip.has(n)) { continue; } @@ -865,7 +865,7 @@ void SceneTree::_notify_group_pause(const StringName &p_group, int p_notificatio } n->notification(p_notification); - //ERR_FAIL_COND(node_count != g.nodes.size()); + //ERR_FAIL_COND(gr_node_count != g.nodes.size()); } call_lock--; @@ -890,17 +890,17 @@ void SceneTree::_call_input_pause(const StringName &p_group, CallInputType p_cal //performance is not lost because only if something is added/removed the vector is copied. Vector<Node *> nodes_copy = g.nodes; - int node_count = nodes_copy.size(); - Node **nodes = nodes_copy.ptrw(); + int gr_node_count = nodes_copy.size(); + Node **gr_nodes = nodes_copy.ptrw(); call_lock++; - for (int i = node_count - 1; i >= 0; i--) { + for (int i = gr_node_count - 1; i >= 0; i--) { if (p_viewport->is_input_handled()) { break; } - Node *n = nodes[i]; + Node *n = gr_nodes[i]; if (call_lock && call_skip.has(n)) { continue; } diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 234cebd821..f7a515dc1d 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -60,8 +60,8 @@ #include "servers/rendering/rendering_server_globals.h" void ViewportTexture::setup_local_to_scene() { - Node *local_scene = get_local_scene(); - if (!local_scene) { + Node *loc_scene = get_local_scene(); + if (!loc_scene) { return; } @@ -71,7 +71,7 @@ void ViewportTexture::setup_local_to_scene() { vp = nullptr; - Node *vpn = local_scene->get_node(path); + Node *vpn = loc_scene->get_node(path); ERR_FAIL_COND_MSG(!vpn, "ViewportTexture: Path to node is invalid."); vp = Object::cast_to<Viewport>(vpn); @@ -635,19 +635,19 @@ void Viewport::_process_picking() { PhysicsDirectSpaceState2D::ShapeResult res[64]; for (const CanvasLayer *E : canvas_layers) { - Transform2D canvas_transform; + Transform2D canvas_layer_transform; ObjectID canvas_layer_id; if (E) { // A descendant CanvasLayer. - canvas_transform = E->get_transform(); + canvas_layer_transform = E->get_transform(); canvas_layer_id = E->get_instance_id(); } else { // This Viewport's builtin canvas. - canvas_transform = get_canvas_transform(); + canvas_layer_transform = get_canvas_transform(); canvas_layer_id = ObjectID(); } - Vector2 point = canvas_transform.affine_inverse().xform(pos); + Vector2 point = canvas_layer_transform.affine_inverse().xform(pos); PhysicsDirectSpaceState2D::PointParameters point_params; point_params.position = point; @@ -4054,16 +4054,10 @@ Viewport::Viewport() { ProjectSettings::get_singleton()->set_custom_property_info("gui/timers/tooltip_delay_sec", PropertyInfo(Variant::FLOAT, "gui/timers/tooltip_delay_sec", PROPERTY_HINT_RANGE, "0,5,0.01,or_greater")); // No negative numbers #ifndef _3D_DISABLED - Viewport::Scaling3DMode scaling_3d_mode = (Viewport::Scaling3DMode)(int)GLOBAL_GET("rendering/scaling_3d/mode"); - set_scaling_3d_mode(scaling_3d_mode); - + set_scaling_3d_mode((Viewport::Scaling3DMode)(int)GLOBAL_GET("rendering/scaling_3d/mode")); set_scaling_3d_scale(GLOBAL_GET("rendering/scaling_3d/scale")); - - float fsr_sharpness = GLOBAL_GET("rendering/scaling_3d/fsr_sharpness"); - set_fsr_sharpness(fsr_sharpness); - - float texture_mipmap_bias = GLOBAL_GET("rendering/textures/default_filters/texture_mipmap_bias"); - set_texture_mipmap_bias(texture_mipmap_bias); + set_fsr_sharpness((float)GLOBAL_GET("rendering/scaling_3d/fsr_sharpness")); + set_texture_mipmap_bias((float)GLOBAL_GET("rendering/textures/default_filters/texture_mipmap_bias")); #endif // _3D_DISABLED set_sdf_oversize(sdf_oversize); // Set to server. diff --git a/scene/main/window.cpp b/scene/main/window.cpp index f7099f3765..7fb3f32d36 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -666,7 +666,7 @@ void Window::_update_viewport_size() { Size2i final_size; Size2i final_size_override; Rect2i attach_to_screen_rect(Point2i(), size); - Transform2D stretch_transform; + Transform2D stretch_transform_new; float font_oversampling = 1.0; if (content_scale_mode == CONTENT_SCALE_MODE_DISABLED || content_scale_size.x == 0 || content_scale_size.y == 0) { @@ -674,8 +674,8 @@ void Window::_update_viewport_size() { final_size = size; final_size_override = Size2(size) / content_scale_factor; - stretch_transform = Transform2D(); - stretch_transform.scale(Size2(content_scale_factor, content_scale_factor)); + stretch_transform_new = Transform2D(); + stretch_transform_new.scale(Size2(content_scale_factor, content_scale_factor)); } else { //actual screen video mode Size2 video_mode = size; @@ -752,7 +752,7 @@ void Window::_update_viewport_size() { font_oversampling = (screen_size.x / viewport_size.x) * content_scale_factor; Size2 scale = Vector2(screen_size) / Vector2(final_size_override); - stretch_transform.scale(scale); + stretch_transform_new.scale(scale); } break; case CONTENT_SCALE_MODE_VIEWPORT: { @@ -764,7 +764,7 @@ void Window::_update_viewport_size() { } bool allocate = is_inside_tree() && visible && (window_id != DisplayServer::INVALID_WINDOW_ID || embedder != nullptr); - _set_size(final_size, final_size_override, attach_to_screen_rect, stretch_transform, allocate); + _set_size(final_size, final_size_override, attach_to_screen_rect, stretch_transform_new, allocate); if (window_id != DisplayServer::INVALID_WINDOW_ID) { RenderingServer::get_singleton()->viewport_attach_to_screen(get_viewport_rid(), attach_to_screen_rect, window_id); @@ -1298,17 +1298,17 @@ bool Window::has_focus() const { Rect2i Window::get_usable_parent_rect() const { ERR_FAIL_COND_V(!is_inside_tree(), Rect2()); - Rect2i parent; + Rect2i parent_rect; if (is_embedded()) { - parent = _get_embedder()->get_visible_rect(); + parent_rect = _get_embedder()->get_visible_rect(); } else { const Window *w = is_visible() ? this : get_parent_visible_window(); //find a parent that can contain us ERR_FAIL_COND_V(!w, Rect2()); - parent = DisplayServer::get_singleton()->screen_get_usable_rect(DisplayServer::get_singleton()->window_get_current_screen(w->get_window_id())); + parent_rect = DisplayServer::get_singleton()->screen_get_usable_rect(DisplayServer::get_singleton()->window_get_current_screen(w->get_window_id())); } - return parent; + return parent_rect; } void Window::add_child_notify(Node *p_child) { @@ -1576,9 +1576,9 @@ Window::LayoutDirection Window::get_layout_direction() const { bool Window::is_layout_rtl() const { if (layout_dir == LAYOUT_DIRECTION_INHERITED) { - Window *parent = Object::cast_to<Window>(get_parent()); - if (parent) { - return parent->is_layout_rtl(); + Window *parent_w = Object::cast_to<Window>(get_parent()); + if (parent_w) { + return parent_w->is_layout_rtl(); } else { if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) { return true; |