Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get_used_rect, get_used_cells and get_used_cells_by_id in TileMap after a call to clear() #83890

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

groud
Copy link
Member

@groud groud commented Oct 24, 2023

Since the 4.2 TileMap refactor, the tile_map data structure could contain an invalid ID before they get cleaned up at the end of the frame.

This made it so get_used_rect, get_used_cells and get_used_cells_by_id would return wrong results just after some cells got deleted.

This PR adds a check to avoid counting invalid tiles to compute de result of those functions.

@groud groud requested a review from a team as a code owner October 24, 2023 12:46
@groud groud added this to the 4.2 milestone Oct 24, 2023
Copy link
Contributor

@smix8 smix8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and fixes the crashes after TileMap.clear() that the 2D navigation mesh baking had.

@akien-mga akien-mga changed the title Fixes get_used_rect, get_used_cells and get_used_cells_by_id in TileMap after a call to clear() Fix get_used_rect, get_used_cells and get_used_cells_by_id in TileMap after a call to clear() Oct 24, 2023
@akien-mga akien-mga changed the title Fix get_used_rect, get_used_cells and get_used_cells_by_id in TileMap after a call to clear() Fix get_used_rect, get_used_cells and get_used_cells_by_id in TileMap after a call to clear() Oct 24, 2023
@akien-mga akien-mga merged commit 8f1c350 into godotengine:master Oct 25, 2023
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants