diff options
-rw-r--r-- | core/math/a_star.cpp | 12 | ||||
-rw-r--r-- | core/math/a_star.h | 4 | ||||
-rw-r--r-- | modules/mono/editor/bindings_generator.cpp | 2 | ||||
-rw-r--r-- | modules/mono/editor/bindings_generator.h | 2 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono.cpp | 3 | ||||
-rw-r--r-- | modules/mono/mono_gd/gd_mono.h | 4 |
6 files changed, 15 insertions, 12 deletions
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp index 60b7326c29..ae2b56e7b7 100644 --- a/core/math/a_star.cpp +++ b/core/math/a_star.cpp @@ -257,14 +257,14 @@ void AStar::reserve_space(int p_num_nodes) { points.reserve(p_num_nodes); } -int AStar::get_closest_point(const Vector3 &p_point) const { +int AStar::get_closest_point(const Vector3 &p_point, bool p_include_disabled) const { int closest_id = -1; real_t closest_dist = 1e20; for (OAHashMap<int, Point *>::Iterator it = points.iter(); it.valid; it = points.next_iter(it)) { - if (!(*it.value)->enabled) continue; // Disabled points should not be considered. + if (!p_include_disabled && !(*it.value)->enabled) continue; // Disabled points should not be considered. real_t d = p_point.distance_squared_to((*it.value)->pos); if (closest_id < 0 || d < closest_dist) { @@ -540,7 +540,7 @@ void AStar::_bind_methods() { ClassDB::bind_method(D_METHOD("reserve_space", "num_nodes"), &AStar::reserve_space); ClassDB::bind_method(D_METHOD("clear"), &AStar::clear); - ClassDB::bind_method(D_METHOD("get_closest_point", "to_position"), &AStar::get_closest_point); + ClassDB::bind_method(D_METHOD("get_closest_point", "to_position", "include_disabled"), &AStar::get_closest_point, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_closest_position_in_segment", "to_position"), &AStar::get_closest_position_in_segment); ClassDB::bind_method(D_METHOD("get_point_path", "from_id", "to_id"), &AStar::get_point_path); @@ -638,8 +638,8 @@ void AStar2D::reserve_space(int p_num_nodes) { astar.reserve_space(p_num_nodes); } -int AStar2D::get_closest_point(const Vector2 &p_point) const { - return astar.get_closest_point(Vector3(p_point.x, p_point.y, 0)); +int AStar2D::get_closest_point(const Vector2 &p_point, bool p_include_disabled) const { + return astar.get_closest_point(Vector3(p_point.x, p_point.y, 0), p_include_disabled); } Vector2 AStar2D::get_closest_position_in_segment(const Vector2 &p_point) const { @@ -693,7 +693,7 @@ void AStar2D::_bind_methods() { ClassDB::bind_method(D_METHOD("reserve_space", "num_nodes"), &AStar2D::reserve_space); ClassDB::bind_method(D_METHOD("clear"), &AStar2D::clear); - ClassDB::bind_method(D_METHOD("get_closest_point", "to_position"), &AStar2D::get_closest_point); + ClassDB::bind_method(D_METHOD("get_closest_point", "to_position", "include_disabled"), &AStar2D::get_closest_point, DEFVAL(false)); ClassDB::bind_method(D_METHOD("get_closest_position_in_segment", "to_position"), &AStar2D::get_closest_position_in_segment); ClassDB::bind_method(D_METHOD("get_point_path", "from_id", "to_id"), &AStar2D::get_point_path); diff --git a/core/math/a_star.h b/core/math/a_star.h index ec2a06f07f..0a5d3e992c 100644 --- a/core/math/a_star.h +++ b/core/math/a_star.h @@ -141,7 +141,7 @@ public: void reserve_space(int p_num_nodes); void clear(); - int get_closest_point(const Vector3 &p_point) const; + int get_closest_point(const Vector3 &p_point, bool p_include_disabled = false) const; Vector3 get_closest_position_in_segment(const Vector3 &p_point) const; PoolVector<Vector3> get_point_path(int p_from_id, int p_to_id); @@ -183,7 +183,7 @@ public: void reserve_space(int p_num_nodes); void clear(); - int get_closest_point(const Vector2 &p_point) const; + int get_closest_point(const Vector2 &p_point, bool p_include_disabled = false) const; Vector2 get_closest_position_in_segment(const Vector2 &p_point) const; PoolVector<Vector2> get_point_path(int p_from_id, int p_to_id); diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 28f098d323..28cab2ab61 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -30,7 +30,7 @@ #include "bindings_generator.h" -#ifdef DEBUG_METHODS_ENABLED +#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED) #include "core/engine.h" #include "core/global_constants.h" diff --git a/modules/mono/editor/bindings_generator.h b/modules/mono/editor/bindings_generator.h index 26718f1d11..8f3676940b 100644 --- a/modules/mono/editor/bindings_generator.h +++ b/modules/mono/editor/bindings_generator.h @@ -36,7 +36,7 @@ #include "editor/doc/doc_data.h" #include "editor/editor_help.h" -#ifdef DEBUG_METHODS_ENABLED +#if defined(DEBUG_METHODS_ENABLED) && defined(TOOLS_ENABLED) #include "core/ustring.h" diff --git a/modules/mono/mono_gd/gd_mono.cpp b/modules/mono/mono_gd/gd_mono.cpp index b2e1deca01..544bfc4615 100644 --- a/modules/mono/mono_gd/gd_mono.cpp +++ b/modules/mono/mono_gd/gd_mono.cpp @@ -430,8 +430,8 @@ void GDMono::_register_internal_calls() { } void GDMono::_initialize_and_check_api_hashes() { - #ifdef MONO_GLUE_ENABLED +#ifdef DEBUG_METHODS_ENABLED if (get_api_core_hash() != GodotSharpBindings::get_core_api_hash()) { ERR_PRINT("Mono: Core API hash mismatch."); } @@ -441,6 +441,7 @@ void GDMono::_initialize_and_check_api_hashes() { ERR_PRINT("Mono: Editor API hash mismatch."); } #endif // TOOLS_ENABLED +#endif // DEBUG_METHODS_ENABLED #endif // MONO_GLUE_ENABLED } diff --git a/modules/mono/mono_gd/gd_mono.h b/modules/mono/mono_gd/gd_mono.h index 4f7d3791f7..343d68bc2d 100644 --- a/modules/mono/mono_gd/gd_mono.h +++ b/modules/mono/mono_gd/gd_mono.h @@ -151,6 +151,7 @@ protected: static GDMono *singleton; public: +#ifdef DEBUG_METHODS_ENABLED uint64_t get_api_core_hash() { if (api_core_hash == 0) api_core_hash = ClassDB::get_api_hash(ClassDB::API_CORE); @@ -162,7 +163,8 @@ public: api_editor_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR); return api_editor_hash; } -#endif +#endif // TOOLS_ENABLED +#endif // DEBUG_METHODS_ENABLED #ifdef TOOLS_ENABLED bool copy_prebuilt_api_assembly(APIAssembly::Type p_api_type, const String &p_config); |