diff options
author | Gilles Roudière <gilles.roudiere@gmail.com> | 2021-09-07 14:59:58 +0200 |
---|---|---|
committer | Gilles Roudière <gilles.roudiere@gmail.com> | 2021-09-07 14:59:58 +0200 |
commit | f36179677110d9a72a7e2ad0831426dfb3cec5f8 (patch) | |
tree | 69b69503a24da78693b7a2cc2594269895323bc6 /editor | |
parent | b0b30aaf41191ccbfdc8786cb79a76efb16d1459 (diff) |
Fix TileSet terrain painting reset to no terrain
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/tiles/tile_data_editors.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index d406c2514c..fd5c59af34 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -1465,12 +1465,13 @@ void TileDataTerrainsEditor::_tile_set_changed() { ERR_FAIL_COND(!tile_set.is_valid()); // Fix if wrong values are selected. - if (int(dummy_object->get("terrain_set")) > tile_set->get_terrain_sets_count()) { + int terrain_set = int(dummy_object->get("terrain_set")); + if (terrain_set >= tile_set->get_terrain_sets_count()) { + terrain_set = -1; dummy_object->set("terrain_set", -1); } - int terrain_set = int(dummy_object->get("terrain")); if (terrain_set >= 0) { - if (int(dummy_object->get("terrain")) > tile_set->get_terrains_count(terrain_set)) { + if (int(dummy_object->get("terrain")) >= tile_set->get_terrains_count(terrain_set)) { dummy_object->set("terrain", -1); } } |