Decouple <cstddef>

This commit is contained in:
Martin Natano
2023-04-20 11:21:29 +02:00
parent 093675cdc3
commit 78fb2e9fc3
171 changed files with 2012 additions and 1786 deletions
+25 -22
View File
@@ -4,7 +4,10 @@
#include "GameCommand.h"
#include "LuaReference.h"
#include "RageUtil.h"
#include <cstddef>
#include <set>
struct MenuRowDef;
class OptionRow;
struct ConfOption;
@@ -77,21 +80,21 @@ struct OptionRowDefinition
* @brief Is this option enabled for the Player?
* @param pn the Player the PlayerNumber represents.
* @return true if the option is enabled, false otherwise. */
bool IsEnabledForPlayer( PlayerNumber pn ) const
bool IsEnabledForPlayer( PlayerNumber pn ) const
{
return m_vEnabledForPlayers.find(pn) != m_vEnabledForPlayers.end();
return m_vEnabledForPlayers.find(pn) != m_vEnabledForPlayers.end();
}
OptionRowDefinition(): m_sName(""), m_sExplanationName(""),
m_bOneChoiceForAllPlayers(false), m_selectType(SELECT_ONE),
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_vsChoices(),
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_vsChoices(),
m_vEnabledForPlayers(), m_iDefault(-1),
m_bExportOnChange(false), m_bAllowThemeItems(true),
m_bAllowThemeTitle(true), m_bAllowExplanation(true),
m_bShowChoicesListOnSelect(false)
{
FOREACH_PlayerNumber( pn )
m_vEnabledForPlayers.insert( pn );
m_vEnabledForPlayers.insert( pn );
}
void Init()
{
@@ -112,20 +115,20 @@ struct OptionRowDefinition
m_bShowChoicesListOnSelect = false;
}
OptionRowDefinition( const char *n, bool b, const char *c0=nullptr,
const char *c1=nullptr, const char *c2=nullptr,
const char *c3=nullptr, const char *c4=nullptr,
const char *c5=nullptr, const char *c6=nullptr,
const char *c7=nullptr, const char *c8=nullptr,
const char *c9=nullptr, const char *c10=nullptr,
const char *c11=nullptr, const char *c12=nullptr,
const char *c13=nullptr, const char *c14=nullptr,
const char *c15=nullptr, const char *c16=nullptr,
const char *c17=nullptr, const char *c18=nullptr,
OptionRowDefinition( const char *n, bool b, const char *c0=nullptr,
const char *c1=nullptr, const char *c2=nullptr,
const char *c3=nullptr, const char *c4=nullptr,
const char *c5=nullptr, const char *c6=nullptr,
const char *c7=nullptr, const char *c8=nullptr,
const char *c9=nullptr, const char *c10=nullptr,
const char *c11=nullptr, const char *c12=nullptr,
const char *c13=nullptr, const char *c14=nullptr,
const char *c15=nullptr, const char *c16=nullptr,
const char *c17=nullptr, const char *c18=nullptr,
const char *c19=nullptr ): m_sName(n),
m_sExplanationName(""), m_bOneChoiceForAllPlayers(b),
m_selectType(SELECT_ONE),
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_vsChoices(),
m_layoutType(LAYOUT_SHOW_ALL_IN_ROW), m_vsChoices(),
m_vEnabledForPlayers(), m_iDefault(-1),
m_bExportOnChange(false), m_bAllowThemeItems(true),
m_bAllowThemeTitle(true), m_bAllowExplanation(true),
@@ -133,7 +136,7 @@ struct OptionRowDefinition
{
FOREACH_PlayerNumber( pn )
m_vEnabledForPlayers.insert( pn );
#define PUSH( c ) if(c) m_vsChoices.push_back(c);
PUSH(c0);PUSH(c1);PUSH(c2);PUSH(c3);PUSH(c4);PUSH(c5);
PUSH(c6);PUSH(c7);PUSH(c8);PUSH(c9);PUSH(c10);PUSH(c11);
@@ -205,7 +208,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
int num_selected = 0;
if( st == SELECT_ONE )
{
size_t first_selected= std::numeric_limits<size_t>::max();
std::size_t first_selected= std::numeric_limits<std::size_t>::max();
if(selected.empty())
{
LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one "
@@ -213,12 +216,12 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
"elements.", sName.c_str());
return;
}
for(size_t e= 0; e < selected.size(); ++e)
for(std::size_t e= 0; e < selected.size(); ++e)
{
if(selected[e])
{
num_selected++;
if(first_selected == std::numeric_limits<size_t>::max())
if(first_selected == std::numeric_limits<std::size_t>::max())
{
first_selected= e;
}
@@ -229,7 +232,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
LuaHelpers::ReportScriptErrorFmt("Option row %s requires only one "
"thing to be selected, but %i out of %i things are selected.",
sName.c_str(), num_selected, static_cast<int>(selected.size()));
for(size_t e= 0; e < selected.size(); ++e)
for(std::size_t e= 0; e < selected.size(); ++e)
{
if(selected[e] && e != first_selected)
{
@@ -252,7 +255,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
* @author Chris Danford (c) 2002-2004
* @section LICENSE
* All rights reserved.
*
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
@@ -262,7 +265,7 @@ inline void VerifySelected(SelectType st, std::vector<bool> &selected, const RSt
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF