diff options
author | kobewi <kobewi4e@gmail.com> | 2022-08-05 20:35:08 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-08-23 23:21:32 +0200 |
commit | 1abdffe7a029daf634f57132cb5ab5d82a7ccfc9 (patch) | |
tree | 1b0d34d6c4bfb94b46b3640e17ce80b5dc291b11 /modules/gridmap | |
parent | d5606503b47a98a5d1d925b2b655760dab850e6e (diff) |
Replace Array return types with TypedArray 2
Diffstat (limited to 'modules/gridmap')
-rw-r--r-- | modules/gridmap/doc_classes/GridMap.xml | 4 | ||||
-rw-r--r-- | modules/gridmap/grid_map.cpp | 12 | ||||
-rw-r--r-- | modules/gridmap/grid_map.h | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/modules/gridmap/doc_classes/GridMap.xml b/modules/gridmap/doc_classes/GridMap.xml index 209890a333..6717f23057 100644 --- a/modules/gridmap/doc_classes/GridMap.xml +++ b/modules/gridmap/doc_classes/GridMap.xml @@ -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]. diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp index 6384446bce..f207d4a741 100644 --- a/modules/gridmap/grid_map.cpp +++ b/modules/gridmap/grid_map.cpp @@ -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); } } diff --git a/modules/gridmap/grid_map.h b/modules/gridmap/grid_map.h index 00cebd35e9..0ed4695fb9 100644 --- a/modules/gridmap/grid_map.h +++ b/modules/gridmap/grid_map.h @@ -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; |