allow GetOneSelection to return -1 when there are none selected

This commit is contained in:
Glenn Maynard
2005-02-14 01:36:54 +00:00
parent e288aaff7c
commit 230ba5b9a9
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -32,12 +32,13 @@ OptionRow::~OptionRow()
}
int OptionRow::GetOneSelection( PlayerNumber pn ) const
int OptionRow::GetOneSelection( PlayerNumber pn, bool bAllowFail ) const
{
for( unsigned i=0; i<(unsigned)m_vbSelected[pn].size(); i++ )
if( m_vbSelected[pn][i] )
return i;
ASSERT(0); // shouldn't call this if not expecting one to be selected
ASSERT( bAllowFail ); // shouldn't call this if not expecting one to be selected
return -1;
}
+1 -1
View File
@@ -57,7 +57,7 @@ public:
// Only one will true at a time if m_RowDef.bMultiSelect
vector<bool> m_vbSelected[NUM_PLAYERS]; // size = m_RowDef.choices.size()
int GetOneSelection( PlayerNumber pn ) const;
int GetOneSelection( PlayerNumber pn, bool bAllowFail=false ) const;
int GetOneSharedSelection() const;
void SetOneSelection( PlayerNumber pn, int iChoice );
void SetOneSharedSelection( int iChoice );