1#ifndef OptionRowHandler_H
2#define OptionRowHandler_H
4#include "GameCommand.h"
5#include "Etterna/Models/Lua/LuaReference.h"
23SelectTypeToString(SelectType x);
25StringToSelectType(
const std::string& s);
26LuaDeclareType(SelectType);
30 LAYOUT_SHOW_ALL_IN_ROW,
31 LAYOUT_SHOW_ONE_IN_ROW,
36LayoutTypeToString(LayoutType x);
38StringToLayoutType(
const std::string& s);
39LuaDeclareType(LayoutType);
44 RELOAD_CHANGED_ENABLED,
50ReloadChangedToString(ReloadChanged x);
52StringToReloadChanged(
const std::string& s);
53LuaDeclareType(ReloadChanged);
64 SelectType m_selectType{ SELECT_ONE };
65 LayoutType m_layoutType{ LAYOUT_SHOW_ALL_IN_ROW };
66 std::vector<std::string> m_vsChoices;
67 std::set<PlayerNumber> m_vEnabledForPlayers;
70 bool m_bExportOnChange{
false };
71 bool m_bExportOnCancel{
false };
90 bool m_bShowChoicesListOnSelect{
false };
98 return m_vEnabledForPlayers.find(pn) != m_vEnabledForPlayers.end();
106 m_vEnabledForPlayers.insert(PLAYER_1);
113 m_selectType = SELECT_ONE;
114 m_layoutType = LAYOUT_SHOW_ALL_IN_ROW;
116 m_vEnabledForPlayers.clear();
117 m_vEnabledForPlayers.insert(PLAYER_1);
119 m_bExportOnChange =
false;
120 m_bExportOnCancel =
false;
124 m_bShowChoicesListOnSelect =
false;
129 const char* c0 =
nullptr,
130 const char* c1 =
nullptr,
131 const char* c2 =
nullptr,
132 const char* c3 =
nullptr,
133 const char* c4 =
nullptr,
134 const char* c5 =
nullptr,
135 const char* c6 =
nullptr,
136 const char* c7 =
nullptr,
137 const char* c8 =
nullptr,
138 const char* c9 =
nullptr,
139 const char* c10 =
nullptr,
140 const char* c11 =
nullptr,
141 const char* c12 =
nullptr,
142 const char* c13 =
nullptr,
143 const char* c14 =
nullptr,
144 const char* c15 =
nullptr,
145 const char* c16 =
nullptr,
146 const char* c17 =
nullptr,
147 const char* c18 =
nullptr,
148 const char* c19 =
nullptr)
154 m_vEnabledForPlayers.insert(PLAYER_1);
158 m_vsChoices.push_back(c);
188 std::vector<std::string>
189 m_vsReloadRowMessages;
196 m_vsReloadRowMessages.clear();
201 return this->LoadInternal(cmds);
204 [[nodiscard]] std::string OptionTitle()
const;
205 [[nodiscard]] std::string GetThemedItemText(
int iChoice)
const;
207 virtual bool LoadInternal(
const Commands&) {
return true; }
218 virtual ReloadChanged Reload() {
return RELOAD_CHANGED_NONE; }
220 [[nodiscard]]
virtual int GetDefaultOption()
const {
return -1; }
223 std::vector<bool>& vbSelectedOut)
const
227 [[nodiscard]]
virtual int ExportOption(
const PlayerNumber&,
228 const std::vector<bool>& vbSelected)
const
232 virtual void GetIconTextAndGameCommand(
int iFirstSelection,
233 std::string& sIconTextOut,
236 [[nodiscard]]
virtual std::string GetScreen(
int )
const
238 return std::string();
242 virtual bool NotifyOfSelection(PlayerNumber pn,
int choice)
246 virtual bool GoToFirstOnStart() {
return true; }
259SelectExactlyOne(
int iSelection, std::vector<bool>& vbSelectedOut);
261GetOneSelection(
const std::vector<bool>& vbSelected);
265VerifySelected(SelectType st, std::vector<bool>& selected,
const std::string& sName)
267 auto num_selected = 0;
268 if (st == SELECT_ONE) {
269 auto first_selected = -1;
270 if (selected.empty()) {
271 LuaHelpers::ReportScriptErrorFmt(
272 "Option row %s requires only one "
273 "thing to be selected, but the list of selected things has zero "
278 for (
unsigned int e = 0; e < selected.size(); ++e) {
281 if (first_selected == -1) {
282 first_selected =
static_cast<int>(e);
286 if (num_selected != 1) {
287 LuaHelpers::ReportScriptErrorFmt(
288 "Option row %s requires only one "
289 "thing to be selected, but %i out of %i things are selected.",
292 static_cast<int>(selected.size()));
293 for (
unsigned int e = 0; e < selected.size(); ++e) {
294 if (selected[e] && e != first_selected) {
298 if (num_selected == 0) {
Definition GameCommand.h:20
Shows PlayerOptions and SongOptions in icon form.
Definition OptionRowHandler.h:185
Definition OptionRow.h:56
Utilities for the OptionRowHandlers.
Definition OptionRowHandler.h:250
Definition ScreenOptionsMasterPrefs.h:26
Define the purpose of the OptionRow.
Definition OptionRowHandler.h:57
std::string m_sName
the name of the option row.
Definition OptionRowHandler.h:59
bool m_bAllowThemeItems
Are theme items allowed here?
Definition OptionRowHandler.h:76
bool IsEnabledForPlayer(PlayerNumber pn) const
Is this option enabled for the Player?
Definition OptionRowHandler.h:96
bool m_bOneChoiceForAllPlayers
Do all players have to share one option from the row?
Definition OptionRowHandler.h:63
std::string m_sExplanationName
an explanation of the row's purpose.
Definition OptionRowHandler.h:61
bool m_bAllowThemeTitle
Are theme titles allowed here?
Definition OptionRowHandler.h:81
bool m_bAllowExplanation
Are explanations allowed for this row?
Definition OptionRowHandler.h:89