From 2667be88f65a569df9ceedbcc449e558196109d4 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 31 Jan 2024 23:17:46 -0600 Subject: [PATCH] [nostalgia/core] Add largestPage function for Palette --- .../modules/core/include/nostalgia/core/palette.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/nostalgia/modules/core/include/nostalgia/core/palette.hpp b/src/nostalgia/modules/core/include/nostalgia/core/palette.hpp index 06eba728..72f97859 100644 --- a/src/nostalgia/modules/core/include/nostalgia/core/palette.hpp +++ b/src/nostalgia/modules/core/include/nostalgia/core/palette.hpp @@ -60,6 +60,15 @@ constexpr size_t colors(Palette const&pal, size_t page = 0) noexcept { return 0; } +[[nodiscard]] +constexpr size_t largestPage(Palette const&pal) noexcept { + size_t out{}; + for (auto const&page : pal.pages) { + out = ox::max(out, page.size()); + } + return out; +} + oxModelBegin(NostalgiaPalette) oxModelField(colors) oxModelEnd()