From 81eaecbc6323077c3919235340b16967dc8ba65f Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 30 Apr 2004 07:24:29 +0000 Subject: [PATCH] add interface for multiple options with the same name --- stepmania/src/StepMania.cpp | 8 +++++++- stepmania/src/StepMania.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 9bf3679888..62f7bac202 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -863,7 +863,7 @@ static void ApplyLogPreferences() * --foo; short arguments (-x) are not supported. (As commandline arguments * are not intended for common, general use, having short options isn't * needed.) If argument is non-NULL, accept an argument. */ -bool GetCommandlineArgument( const CString &option, CString *argument ) +bool GetCommandlineArgument( const CString &option, CString *argument, int iIndex ) { const CString optstr = "--" + option; @@ -877,6 +877,12 @@ bool GetCommandlineArgument( const CString &option, CString *argument ) continue; /* no match */ /* Found it. */ + if( iIndex ) + { + --iIndex; + continue; + } + if( argument ) { if( i != CString::npos ) diff --git a/stepmania/src/StepMania.h b/stepmania/src/StepMania.h index 288f06b8a0..7dde4a4ea7 100644 --- a/stepmania/src/StepMania.h +++ b/stepmania/src/StepMania.h @@ -31,6 +31,6 @@ extern HWND g_hWndMain; extern int g_argc; extern char **g_argv; -bool GetCommandlineArgument( const CString &option, CString *argument=NULL ); +bool GetCommandlineArgument( const CString &option, CString *argument=NULL, int iIndex=0 ); #endif