summaryrefslogtreecommitdiff
path: root/scene/2d/navigation_polygon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/2d/navigation_polygon.cpp')
-rw-r--r--scene/2d/navigation_polygon.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index 779751c1c5..352ec3b300 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -30,6 +30,7 @@
#include "navigation_polygon.h"
#include "core_string_names.h"
+#include "engine.h"
#include "navigation2d.h"
#include "thirdparty/misc/triangulator.h"
@@ -297,7 +298,7 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) {
}
}
- if (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())
+ if (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint())
update();
//update_gizmo();
@@ -318,7 +319,7 @@ void NavigationPolygonInstance::_notification(int p_what) {
Node2D *c = this;
while (c) {
- navigation = c->cast_to<Navigation2D>();
+ navigation = Object::cast_to<Navigation2D>(c);
if (navigation) {
if (enabled && navpoly.is_valid()) {
@@ -328,7 +329,7 @@ void NavigationPolygonInstance::_notification(int p_what) {
break;
}
- c = c->get_parent()->cast_to<Node2D>();
+ c = Object::cast_to<Node2D>(get_parent());
}
} break;
@@ -352,7 +353,7 @@ void NavigationPolygonInstance::_notification(int p_what) {
} break;
case NOTIFICATION_DRAW: {
- if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) {
+ if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()) && navpoly.is_valid()) {
PoolVector<Vector2> verts = navpoly->get_vertices();
int vsize = verts.size();
@@ -432,7 +433,7 @@ Ref<NavigationPolygon> NavigationPolygonInstance::get_navigation_polygon() const
void NavigationPolygonInstance::_navpoly_changed() {
- if (is_inside_tree() && (get_tree()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()))
+ if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()))
update();
}
@@ -447,11 +448,11 @@ String NavigationPolygonInstance::get_configuration_warning() const {
const Node2D *c = this;
while (c) {
- if (c->cast_to<Navigation2D>()) {
+ if (Object::cast_to<Navigation2D>(c)) {
return String();
}
- c = c->get_parent()->cast_to<Node2D>();
+ c = Object::cast_to<Node2D>(get_parent());
}
return TTR("NavigationPolygonInstance must be a child or grandchild to a Navigation2D node. It only provides navigation data.");