|
@@ -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()) {
|