From 4e183dbc4cf61855bd4353017683e02f19f89461 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 4 Jan 2012 01:27:25 -0700 Subject: Mingw builds automaticaly now. --- src/main.cpp | 7 ++++++- src/options.cpp | 8 ++++++++ src/options.h | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 7e2ef7f..262e7c4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,10 +18,15 @@ int main( int argc, char *argv[] ) Options &opt = Options::getInstance(); opt.parse( argc, argv ); + if( opt.sFile.isEmpty() ) + { + sio << "You must specify a stage script filename." << sio.nl; + return 1; + } srandom( time( NULL ) ); GameBuilder bld; - bld.parse( argv[1] ); + bld.parse( opt.sFile ); Game *pGame = bld.getGame(); GameState gs( pGame ); diff --git a/src/options.cpp b/src/options.cpp index 0483759..42f58a2 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -26,6 +26,7 @@ void Options::parse( int argc, char *argv[] ) " [options] \n"); opt.addOption( Bu::slot( this, &Options::version ), Bu::String("version"), Bu::String("Show the version info.") ); opt.addHelpOption('h', "help"); + opt.setNonOption( Bu::slot( this, &Options::nonOption ) ); opt.parse( argc, argv ); } @@ -41,3 +42,10 @@ int Options::version( Bu::StrArray aArgs ) return 0; } +int Options::nonOption( Bu::Array aArgs ) +{ + sFile = aArgs[0]; + + return 0; +} + diff --git a/src/options.h b/src/options.h index 7fe2633..09ad19a 100644 --- a/src/options.h +++ b/src/options.h @@ -17,7 +17,9 @@ public: Bu::String sFile; +protected: int version( Bu::Array aArgs ); + int nonOption( Bu::Array aArgs ); }; #endif -- cgit v1.2.3