diff options
author | kobewi <kobewi4e@gmail.com> | 2022-09-13 01:27:10 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-09-13 01:39:35 +0200 |
commit | 7afaca2091b63c50ae8c9f5809bef9ec7e836db4 (patch) | |
tree | 4d537b77ad4e028c300f76a5496c4def7de24b65 /scene | |
parent | 16228ba3e27b57df48256fcdf34670a25b3d52b0 (diff) | |
download | redot-engine-7afaca2091b63c50ae8c9f5809bef9ec7e836db4.tar.gz |
Don't print error in get_cell_tile_data()
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/tile_map.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 5de6d547d7..a881247ad7 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -2026,7 +2026,7 @@ void TileMap::erase_cell(int p_layer, const Vector2i &p_coords) { int TileMap::get_cell_source_id(int p_layer, const Vector2i &p_coords, bool p_use_proxies) const { ERR_FAIL_INDEX_V(p_layer, (int)layers.size(), TileSet::INVALID_SOURCE); - // Get a cell source id from position + // Get a cell source id from position. const HashMap<Vector2i, TileMapCell> &tile_map = layers[p_layer].tile_map; HashMap<Vector2i, TileMapCell>::ConstIterator E = tile_map.find(p_coords); @@ -2082,7 +2082,9 @@ int TileMap::get_cell_alternative_tile(int p_layer, const Vector2i &p_coords, bo TileData *TileMap::get_cell_tile_data(int p_layer, const Vector2i &p_coords, bool p_use_proxies) const { int source_id = get_cell_source_id(p_layer, p_coords, p_use_proxies); - ERR_FAIL_COND_V_MSG(source_id == TileSet::INVALID_SOURCE, nullptr, vformat("Invalid TileSetSource at cell %s. Make sure a tile exists at this cell.", p_coords)); + if (source_id == TileSet::INVALID_SOURCE) { + return nullptr; + } Ref<TileSetAtlasSource> source = tile_set->get_source(source_id); if (source.is_valid()) { |