Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/server/menu/menu_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,8 @@ void Menu::Render(gentity_t* ent) const {
const int maxOffset = std::max(0, totalScrollable - MAX_VISIBLE_LINES);
const int offset = std::clamp(scrollOffset, 0, maxOffset);

const auto scrollableView = entries | std::views::filter([](const MenuEntry& entry) {
return entry.scrollable;
});

const bool hasAbove = (std::ranges::distance(scrollableView | std::views::take(offset)) > 0);
const bool hasBelow = (std::ranges::distance(scrollableView | std::views::drop(offset + MAX_VISIBLE_LINES)) > 0);
const bool hasAbove = (offset > 0);
const bool hasBelow = (offset < maxOffset);

const auto afterOffsetView = entries | std::views::drop_while([skipScrollable = offset](const MenuEntry& entry) mutable {
if (!entry.scrollable)
Expand Down