Merge pull request #64009 from KoBeWi/arrayy_lmao
Replace Array return types with TypedArray (part 2)
This commit is contained in:
commit
91e5f48ea7
75 changed files with 301 additions and 263 deletions
|
|
@ -102,13 +102,13 @@
|
|||
</description>
|
||||
</method>
|
||||
<method name="get_used_cells" qualifiers="const">
|
||||
<return type="Array" />
|
||||
<return type="Vector3i[]" />
|
||||
<description>
|
||||
Returns an array of [Vector3] with the non-empty cell coordinates in the grid map.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_used_cells_by_item" qualifiers="const">
|
||||
<return type="Array" />
|
||||
<return type="Vector3i[]" />
|
||||
<param index="0" name="item" type="int" />
|
||||
<description>
|
||||
Returns an array of all cells with the given item index specified in [code]item[/code].
|
||||
|
|
|
|||
|
|
@ -1049,23 +1049,23 @@ float GridMap::get_cell_scale() const {
|
|||
return cell_scale;
|
||||
}
|
||||
|
||||
Array GridMap::get_used_cells() const {
|
||||
Array a;
|
||||
TypedArray<Vector3i> GridMap::get_used_cells() const {
|
||||
TypedArray<Vector3i> a;
|
||||
a.resize(cell_map.size());
|
||||
int i = 0;
|
||||
for (const KeyValue<IndexKey, Cell> &E : cell_map) {
|
||||
Vector3 p(E.key.x, E.key.y, E.key.z);
|
||||
Vector3i p(E.key.x, E.key.y, E.key.z);
|
||||
a[i++] = p;
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
Array GridMap::get_used_cells_by_item(int p_item) const {
|
||||
Array a;
|
||||
TypedArray<Vector3i> GridMap::get_used_cells_by_item(int p_item) const {
|
||||
TypedArray<Vector3i> a;
|
||||
for (const KeyValue<IndexKey, Cell> &E : cell_map) {
|
||||
if (E.value.item == p_item) {
|
||||
Vector3 p(E.key.x, E.key.y, E.key.z);
|
||||
Vector3i p(E.key.x, E.key.y, E.key.z);
|
||||
a.push_back(p);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,8 +273,8 @@ public:
|
|||
void set_cell_scale(float p_scale);
|
||||
float get_cell_scale() const;
|
||||
|
||||
Array get_used_cells() const;
|
||||
Array get_used_cells_by_item(int p_item) const;
|
||||
TypedArray<Vector3i> get_used_cells() const;
|
||||
TypedArray<Vector3i> get_used_cells_by_item(int p_item) const;
|
||||
|
||||
Array get_meshes() const;
|
||||
|
||||
|
|
|
|||
|
|
@ -123,8 +123,8 @@ void GodotNavigationServer::add_command(SetCommand *command) const {
|
|||
}
|
||||
}
|
||||
|
||||
Array GodotNavigationServer::get_maps() const {
|
||||
Array all_map_rids;
|
||||
TypedArray<RID> GodotNavigationServer::get_maps() const {
|
||||
TypedArray<RID> all_map_rids;
|
||||
List<RID> maps_owned;
|
||||
map_owner.get_owned_list(&maps_owned);
|
||||
if (maps_owned.size()) {
|
||||
|
|
@ -245,8 +245,8 @@ RID GodotNavigationServer::map_get_closest_point_owner(RID p_map, const Vector3
|
|||
return map->get_closest_point_owner(p_point);
|
||||
}
|
||||
|
||||
Array GodotNavigationServer::map_get_regions(RID p_map) const {
|
||||
Array regions_rids;
|
||||
TypedArray<RID> GodotNavigationServer::map_get_regions(RID p_map) const {
|
||||
TypedArray<RID> regions_rids;
|
||||
const NavMap *map = map_owner.get_or_null(p_map);
|
||||
ERR_FAIL_COND_V(map == nullptr, regions_rids);
|
||||
const LocalVector<NavRegion *> regions = map->get_regions();
|
||||
|
|
@ -257,8 +257,8 @@ Array GodotNavigationServer::map_get_regions(RID p_map) const {
|
|||
return regions_rids;
|
||||
}
|
||||
|
||||
Array GodotNavigationServer::map_get_agents(RID p_map) const {
|
||||
Array agents_rids;
|
||||
TypedArray<RID> GodotNavigationServer::map_get_agents(RID p_map) const {
|
||||
TypedArray<RID> agents_rids;
|
||||
const NavMap *map = map_owner.get_or_null(p_map);
|
||||
ERR_FAIL_COND_V(map == nullptr, agents_rids);
|
||||
const LocalVector<RvoAgent *> agents = map->get_agents();
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public:
|
|||
|
||||
void add_command(SetCommand *command) const;
|
||||
|
||||
virtual Array get_maps() const override;
|
||||
virtual TypedArray<RID> get_maps() const override;
|
||||
|
||||
virtual RID map_create() const override;
|
||||
COMMAND_2(map_set_active, RID, p_map, bool, p_active);
|
||||
|
|
@ -107,8 +107,8 @@ public:
|
|||
virtual Vector3 map_get_closest_point_normal(RID p_map, const Vector3 &p_point) const override;
|
||||
virtual RID map_get_closest_point_owner(RID p_map, const Vector3 &p_point) const override;
|
||||
|
||||
virtual Array map_get_regions(RID p_map) const override;
|
||||
virtual Array map_get_agents(RID p_map) const override;
|
||||
virtual TypedArray<RID> map_get_regions(RID p_map) const override;
|
||||
virtual TypedArray<RID> map_get_agents(RID p_map) const override;
|
||||
|
||||
virtual void map_force_update(RID p_map) override;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue