Merge pull request #58669 from theraot/ASar2Dbidirectional

AStar2D bidirectional
This commit is contained in:
Rémi Verschelde 2022-06-16 12:46:51 +02:00 committed by GitHub
commit 1ad6fade00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 10 deletions

View File

@ -621,12 +621,12 @@ void AStar2D::connect_points(int p_id, int p_with_id, bool p_bidirectional) {
astar.connect_points(p_id, p_with_id, p_bidirectional);
}
void AStar2D::disconnect_points(int p_id, int p_with_id) {
astar.disconnect_points(p_id, p_with_id);
void AStar2D::disconnect_points(int p_id, int p_with_id, bool p_bidirectional) {
astar.disconnect_points(p_id, p_with_id, p_bidirectional);
}
bool AStar2D::are_points_connected(int p_id, int p_with_id) const {
return astar.are_points_connected(p_id, p_with_id);
bool AStar2D::are_points_connected(int p_id, int p_with_id, bool p_bidirectional) const {
return astar.are_points_connected(p_id, p_with_id, p_bidirectional);
}
int AStar2D::get_point_count() const {
@ -863,8 +863,8 @@ void AStar2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_point_disabled", "id"), &AStar2D::is_point_disabled);
ClassDB::bind_method(D_METHOD("connect_points", "id", "to_id", "bidirectional"), &AStar2D::connect_points, DEFVAL(true));
ClassDB::bind_method(D_METHOD("disconnect_points", "id", "to_id"), &AStar2D::disconnect_points);
ClassDB::bind_method(D_METHOD("are_points_connected", "id", "to_id"), &AStar2D::are_points_connected);
ClassDB::bind_method(D_METHOD("disconnect_points", "id", "to_id", "bidirectional"), &AStar2D::disconnect_points, DEFVAL(true));
ClassDB::bind_method(D_METHOD("are_points_connected", "id", "to_id", "bidirectional"), &AStar2D::are_points_connected, DEFVAL(true));
ClassDB::bind_method(D_METHOD("get_point_count"), &AStar2D::get_point_count);
ClassDB::bind_method(D_METHOD("get_point_capacity"), &AStar2D::get_point_capacity);

View File

@ -195,8 +195,8 @@ public:
bool is_point_disabled(int p_id) const;
void connect_points(int p_id, int p_with_id, bool p_bidirectional = true);
void disconnect_points(int p_id, int p_with_id);
bool are_points_connected(int p_id, int p_with_id) const;
void disconnect_points(int p_id, int p_with_id, bool p_bidirectional = true);
bool are_points_connected(int p_id, int p_with_id, bool p_bidirectional = true) const;
int get_point_count() const;
int get_point_capacity() const;

View File

@ -52,8 +52,9 @@
<return type="bool" />
<argument index="0" name="id" type="int" />
<argument index="1" name="to_id" type="int" />
<argument index="2" name="bidirectional" type="bool" default="true" />
<description>
Returns whether there is a connection/segment between the given points.
Returns whether there is a connection/segment between the given points. If [code]bidirectional[/code] is [code]false[/code], returns whether movement from [code]id[/code] to [code]to_id[/code] is possible through this segment.
</description>
</method>
<method name="clear">
@ -89,8 +90,9 @@
<return type="void" />
<argument index="0" name="id" type="int" />
<argument index="1" name="to_id" type="int" />
<argument index="2" name="bidirectional" type="bool" default="true" />
<description>
Deletes the segment between the given points.
Deletes the segment between the given points. If [code]bidirectional[/code] is [code]false[/code], only movement from [code]id[/code] to [code]to_id[/code] is prevented, and a unidirectional segment possibly remains.
</description>
</method>
<method name="get_available_point_id" qualifiers="const">