From 230ba5b9a9ddbae405123fa714aabfa3e5e0ef92 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Mon, 14 Feb 2005 01:36:54 +0000 Subject: [PATCH] allow GetOneSelection to return -1 when there are none selected --- stepmania/src/OptionRow.cpp | 5 +++-- stepmania/src/OptionRow.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stepmania/src/OptionRow.cpp b/stepmania/src/OptionRow.cpp index 14c8d35a28..153e666897 100644 --- a/stepmania/src/OptionRow.cpp +++ b/stepmania/src/OptionRow.cpp @@ -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; } diff --git a/stepmania/src/OptionRow.h b/stepmania/src/OptionRow.h index adb5ece967..668f0f2d17 100644 --- a/stepmania/src/OptionRow.h +++ b/stepmania/src/OptionRow.h @@ -57,7 +57,7 @@ public: // Only one will true at a time if m_RowDef.bMultiSelect vector 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 );