summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-01-04 01:27:25 -0700
committerMike Buland <eichlan@xagasoft.com>2012-01-04 01:27:25 -0700
commit4e183dbc4cf61855bd4353017683e02f19f89461 (patch)
treea6d7dbd236a11710f4a9a72fbd76fc700b4956e0 /src
parent90e4545e2e59462786169637fe58b574d07b9ee1 (diff)
downloadstage-4e183dbc4cf61855bd4353017683e02f19f89461.tar.gz
stage-4e183dbc4cf61855bd4353017683e02f19f89461.tar.bz2
stage-4e183dbc4cf61855bd4353017683e02f19f89461.tar.xz
stage-4e183dbc4cf61855bd4353017683e02f19f89461.zip
Mingw builds automaticaly now.0.01
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp7
-rw-r--r--src/options.cpp8
-rw-r--r--src/options.h2
3 files changed, 16 insertions, 1 deletions
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[] )
18 Options &opt = Options::getInstance(); 18 Options &opt = Options::getInstance();
19 opt.parse( argc, argv ); 19 opt.parse( argc, argv );
20 20
21 if( opt.sFile.isEmpty() )
22 {
23 sio << "You must specify a stage script filename." << sio.nl;
24 return 1;
25 }
21 srandom( time( NULL ) ); 26 srandom( time( NULL ) );
22 27
23 GameBuilder bld; 28 GameBuilder bld;
24 bld.parse( argv[1] ); 29 bld.parse( opt.sFile );
25 Game *pGame = bld.getGame(); 30 Game *pGame = bld.getGame();
26 31
27 GameState gs( pGame ); 32 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[] )
26 " [options] <filename>\n"); 26 " [options] <filename>\n");
27 opt.addOption( Bu::slot( this, &Options::version ), Bu::String("version"), Bu::String("Show the version info.") ); 27 opt.addOption( Bu::slot( this, &Options::version ), Bu::String("version"), Bu::String("Show the version info.") );
28 opt.addHelpOption('h', "help"); 28 opt.addHelpOption('h', "help");
29 opt.setNonOption( Bu::slot( this, &Options::nonOption ) );
29 opt.parse( argc, argv ); 30 opt.parse( argc, argv );
30} 31}
31 32
@@ -41,3 +42,10 @@ int Options::version( Bu::StrArray aArgs )
41 return 0; 42 return 0;
42} 43}
43 44
45int Options::nonOption( Bu::Array<Bu::String> aArgs )
46{
47 sFile = aArgs[0];
48
49 return 0;
50}
51
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:
17 17
18 Bu::String sFile; 18 Bu::String sFile;
19 19
20protected:
20 int version( Bu::Array<Bu::String> aArgs ); 21 int version( Bu::Array<Bu::String> aArgs );
22 int nonOption( Bu::Array<Bu::String> aArgs );
21}; 23};
22 24
23#endif 25#endif