diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-23 10:05:55 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2022-10-23 10:05:55 +0200 |
commit | db2a8661d5dc8cecb4fea80d5cfec237af67ea24 (patch) | |
tree | 71399da7d004402863e8f7872f9cf554a93de381 /main/editor.cpp | |
parent | 6e3610344e9af648874e560a364ce62a424e8e15 (diff) |
add atlas selected indicator
Diffstat (limited to 'main/editor.cpp')
-rw-r--r-- | main/editor.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/main/editor.cpp b/main/editor.cpp index 709ab13b..f3c8b157 100644 --- a/main/editor.cpp +++ b/main/editor.cpp @@ -79,15 +79,28 @@ void tile_type::select_tile_permutation(const std::shared_ptr<tile_atlas>& atlas bool tile_type::is_tile_selected(const std::shared_ptr<const tile_atlas>& atlas, std::size_t variant) const { - fm_assert(atlas); - return _selection_mode == sel_tile && _selected_tile && + return atlas && _selection_mode == sel_tile && _selected_tile && atlas == _selected_tile.atlas && variant == _selected_tile.variant; } bool tile_type::is_permutation_selected(const std::shared_ptr<const tile_atlas>& atlas) const { - fm_assert(atlas); - return _selection_mode == sel_perm && std::get<0>(_permutation) == atlas; + const auto& [perm, _] = _permutation; + return atlas && _selection_mode == sel_perm && perm == atlas; +} + +bool tile_type::is_atlas_selected(const std::shared_ptr<const tile_atlas>& atlas) const +{ + switch (_selection_mode) + { + default: + case sel_none: + return false; + case sel_perm: + return is_permutation_selected(atlas); + case sel_tile: + return atlas && _selected_tile && atlas == _selected_tile.atlas; + } } template<std::random_access_iterator T> |