diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f772ae3123..c29df4338d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -247,8 +247,6 @@ elseif(APPLE) "${SM_XCODE_DIR}/plistHelper.hpp" XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/archutils/Darwin/StepMania.pch" - XCODE_ATTRIBUTE_GCC_ENABLE_CPP_EXCEPTIONS - "NO" XCODE_ATTRIBUTE_LIBRARY_SEARCH_PATHS "${SM_XCODE_DIR}/Libraries") diff --git a/src/NoteDataUtil.cpp b/src/NoteDataUtil.cpp index 330b3f0b58..ee5e321258 100644 --- a/src/NoteDataUtil.cpp +++ b/src/NoteDataUtil.cpp @@ -11,6 +11,17 @@ #include "TimingData.h" #include +bool NoteDataUtil::StringInterpretsAs( const std::string& str, int integer ) { + try + { + return std::stoi( str ) == integer; + } + catch ( const std::invalid_argument & ) + { + return false; + } +} + // TODO: Remove these constants that aren't time signature-aware static const int BEATS_PER_MEASURE = 4; static const int ROWS_PER_MEASURE = ROWS_PER_BEAT * BEATS_PER_MEASURE; diff --git a/src/NoteDataUtil.h b/src/NoteDataUtil.h index a855ddd2a6..8b9ea53432 100644 --- a/src/NoteDataUtil.h +++ b/src/NoteDataUtil.h @@ -23,6 +23,11 @@ void LightTransformHelper( const NoteData &in, NoteData &out, const vector * and makes it much easier to change NoteData internally in the future. */ namespace NoteDataUtil { + /** + * @brief Whether a string can be interpreted as the provided signed integer + */ + bool StringInterpretsAs( const std::string& str, int integer ); + NoteType GetSmallestNoteTypeForMeasure( const NoteData &nd, int iMeasureIndex ); NoteType GetSmallestNoteTypeInRange( const NoteData &nd, int iStartIndex, int iEndIndex ); void LoadFromSMNoteDataString( NoteData &out, const RString &sSMNoteData, bool bComposite ); diff --git a/src/NotesLoaderSM.cpp b/src/NotesLoaderSM.cpp index 8f2c219912..b0b52148a2 100644 --- a/src/NotesLoaderSM.cpp +++ b/src/NotesLoaderSM.cpp @@ -3,6 +3,7 @@ #include "BackgroundUtil.h" #include "GameManager.h" #include "MsdFile.h" +#include "NoteDataUtil.h" #include "NoteTypes.h" #include "RageFileManager.h" #include "RageLog.h" @@ -974,28 +975,26 @@ bool SMLoader::LoadFromBGChangesVector( BackgroundChange &change, std::vector