Make newmenu::tiny_mode_flag, tabs_flag, max_on_menu const

This commit is contained in:
Kp 2020-12-19 16:13:26 +00:00
parent 200952c3d9
commit 530f396b2e
2 changed files with 7 additions and 11 deletions

View file

@ -199,17 +199,19 @@ struct newmenu_layout
const menu_title title;
const menu_subtitle subtitle;
const menu_filename filename;
tiny_mode_flag tiny_mode;
tab_processing_flag tabs_flag;
const tiny_mode_flag tiny_mode;
const tab_processing_flag tabs_flag;
const uint8_t max_on_menu;
uint8_t all_text = 0; //set true if all text items
uint8_t is_scroll_box = 0; // Is this a scrolling box? Set to false at init
uint8_t mouse_state;
int max_on_menu;
const partial_range_t<newmenu_item *> items;
int scroll_offset = 0;
int max_displayable;
newmenu_layout(menu_title title, menu_subtitle subtitle, menu_filename filename, partial_range_t<newmenu_item *> items) :
newmenu_layout(menu_title title, menu_subtitle subtitle, menu_filename filename, tiny_mode_flag tiny_mode, tab_processing_flag tabs_flag, partial_range_t<newmenu_item *> items) :
title(title), subtitle(subtitle), filename(filename),
tiny_mode(tiny_mode), tabs_flag(tabs_flag),
max_on_menu(std::min<uint8_t>(items.size(), tiny_mode != tiny_mode_flag::normal ? 21u : 14u)),
items(items)
{
}

View file

@ -76,8 +76,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include "d_zip.h"
#include "partial_range.h"
#define MAXDISPLAYABLEITEMS 14
#define MAXDISPLAYABLEITEMSTINY 21
#define MESSAGEBOX_TEXT_SIZE 2176 // How many characters in messagebox
#define MAX_TEXT_WIDTH FSPACX(120) // How many pixels wide a input box can be
@ -1422,7 +1420,6 @@ static void newmenu_create_structure(newmenu_layout &menu, const grs_font &cv_fo
else
{
menu.is_scroll_box = 0;
menu.max_on_menu = menu.items.size();
}
menu.h = iterative_layout_max_height;
@ -1681,11 +1678,8 @@ newmenu *newmenu_do4(const menu_title title, const menu_subtitle subtitle, const
{
if (items.size() < 1)
return nullptr;
newmenu_layout nl(title, subtitle, filename, items);
newmenu_layout nl(title, subtitle, filename, TinyMode, TabsFlag, items);
nl.citem = citem;
nl.max_on_menu = TinyMode != tiny_mode_flag::normal ? MAXDISPLAYABLEITEMSTINY : MAXDISPLAYABLEITEMS;
nl.tiny_mode = TinyMode;
nl.tabs_flag = TabsFlag;
nl.max_displayable = items.size();
newmenu_create_structure(nl, *(TinyMode != tiny_mode_flag::normal ? GAME_FONT : MEDIUM1_FONT));
auto menu = std::make_unique<newmenu>(grd_curscreen->sc_canvas, std::move(nl));