summaryrefslogtreecommitdiffhomepage
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/editor.cpp6
-rw-r--r--main/imgui.cpp4
-rw-r--r--main/update.cpp2
3 files changed, 6 insertions, 6 deletions
diff --git a/main/editor.cpp b/main/editor.cpp
index cfe793b9..4ac16024 100644
--- a/main/editor.cpp
+++ b/main/editor.cpp
@@ -29,7 +29,7 @@ void tile_type::load_atlases()
if (auto x = name.findLast('.'); x)
name = name.prefix(x.data());
auto& [_, vec] = _permutation;
- vec.reserve((std::size_t)atlas->num_tiles().product());
+ vec.reserve((std::size_t)atlas->num_tiles());
_atlases[name] = std::move(atlas);
}
}
@@ -66,7 +66,7 @@ void tile_type::select_tile(const std::shared_ptr<tile_atlas>& atlas, std::uint8
fm_assert(atlas);
clear_selection();
_selection_mode = sel_tile;
- _selected_tile = { atlas, variant };
+ _selected_tile = { atlas, variant % atlas->num_tiles() };
}
void tile_type::select_tile_permutation(const std::shared_ptr<tile_atlas>& atlas)
@@ -104,7 +104,7 @@ void fisher_yates(T begin, T end)
std::tuple<std::shared_ptr<tile_atlas>, std::uint8_t> tile_type::get_selected_perm()
{
auto& [atlas, vec] = _permutation;
- const std::size_t N = atlas->num_tiles().product();
+ const std::size_t N = atlas->num_tiles();
if (N == 0)
return {};
if (vec.empty())
diff --git a/main/imgui.cpp b/main/imgui.cpp
index 6f0d7c11..e202fd08 100644
--- a/main/imgui.cpp
+++ b/main/imgui.cpp
@@ -103,11 +103,11 @@ void app::draw_editor_pane(tile_type& type, float main_menu_height)
_editor.floor().select_tile_permutation(v_);
};
const auto add_tile_count = [&] {
- snprintf(buf, sizeof(buf), "%zu", (std::size_t)v_->num_tiles().product());
+ snprintf(buf, sizeof(buf), "%zu", (std::size_t)v_->num_tiles());
ImGui::SameLine(window_width - ImGui::CalcTextSize(buf).x - style.FramePadding.x - 4);
ImGui::Text("%s", buf);
};
- const std::size_t N = v->num_tiles().product();
+ const std::size_t N = v->num_tiles();
if (const auto flags = ImGuiTreeNodeFlags_(ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_Framed);
auto b = tree_node(k.data(), flags))
{
diff --git a/main/update.cpp b/main/update.cpp
index 0d93b0c2..8b0e221f 100644
--- a/main/update.cpp
+++ b/main/update.cpp
@@ -7,7 +7,7 @@ void app::make_test_chunk(chunk& c)
constexpr auto N = TILE_MAX_DIM;
for (auto [x, k, pt] : c) {
const auto& atlas = pt.x != pt.y && (pt.x == N/2 || pt.y == N/2) ? floor2 : floor1;
- x.ground_image = { atlas, (std::uint8_t)(k % atlas->num_tiles().product()) };
+ x.ground_image = { atlas, (std::uint8_t)(k % atlas->num_tiles()) };
}
constexpr auto K = N/2;
c[{K, K }].wall_north = { wall1, 0 };