refactor(TileMap): Return Rect2i in get_used_rect

Signed-off-by: MisterMX <mbxd12@web.de>
This commit is contained in:
MisterMX 2022-09-28 17:03:50 +02:00
parent 7f113042c0
commit 407bbdda20
3 changed files with 3 additions and 3 deletions

View File

@ -188,7 +188,7 @@
</description> </description>
</method> </method>
<method name="get_used_rect"> <method name="get_used_rect">
<return type="Rect2" /> <return type="Rect2i" />
<description> <description>
Returns a rectangle enclosing the used (non-empty) tiles of the map, including all layers. Returns a rectangle enclosing the used (non-empty) tiles of the map, including all layers.
</description> </description>

View File

@ -3615,7 +3615,7 @@ TypedArray<Vector2i> TileMap::get_used_cells(int p_layer) const {
return a; return a;
} }
Rect2 TileMap::get_used_rect() { // Not const because of cache Rect2i TileMap::get_used_rect() { // Not const because of cache
// Return the rect of the currently used area // Return the rect of the currently used area
if (used_rect_cache_dirty) { if (used_rect_cache_dirty) {
bool first = true; bool first = true;

View File

@ -375,7 +375,7 @@ public:
Vector2i get_neighbor_cell(const Vector2i &p_coords, TileSet::CellNeighbor p_cell_neighbor) const; Vector2i get_neighbor_cell(const Vector2i &p_coords, TileSet::CellNeighbor p_cell_neighbor) const;
TypedArray<Vector2i> get_used_cells(int p_layer) const; TypedArray<Vector2i> get_used_cells(int p_layer) const;
Rect2 get_used_rect(); // Not const because of cache Rect2i get_used_rect(); // Not const because of cache
// Override some methods of the CanvasItem class to pass the changes to the quadrants CanvasItems // Override some methods of the CanvasItem class to pass the changes to the quadrants CanvasItems
virtual void set_light_mask(int p_light_mask) override; virtual void set_light_mask(int p_light_mask) override;