From db2a8661d5dc8cecb4fea80d5cfec237af67ea24 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 23 Oct 2022 10:05:55 +0200 Subject: add atlas selected indicator --- main/editor.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'main/editor.cpp') 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& atlas bool tile_type::is_tile_selected(const std::shared_ptr& 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& 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& 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 -- cgit v1.2.3