diff options
| -rw-r--r-- | default.bld | 9 | ||||
| -rw-r--r-- | mingw.bld | 3 | ||||
| -rw-r--r-- | src/main.cpp | 7 | ||||
| -rw-r--r-- | src/options.cpp | 8 | ||||
| -rw-r--r-- | src/options.h | 2 |
5 files changed, 28 insertions, 1 deletions
diff --git a/default.bld b/default.bld index f36c76b..bacbb6b 100644 --- a/default.bld +++ b/default.bld | |||
| @@ -1,4 +1,13 @@ | |||
| 1 | 1 | ||
| 2 | if exists("src/parser.yy.cpp") then | ||
| 3 | { | ||
| 4 | unlink("src/parser.yy.cpp"); | ||
| 5 | } | ||
| 6 | if exists("src/parser.tab.cpp") then | ||
| 7 | { | ||
| 8 | unlink("src/parser.tab.cpp"); | ||
| 9 | } | ||
| 10 | |||
| 2 | action "default" | 11 | action "default" |
| 3 | { | 12 | { |
| 4 | build: ["src/version.h", "stage"]; | 13 | build: ["src/version.h", "stage"]; |
| @@ -1,5 +1,8 @@ | |||
| 1 | #build-m3 file for fishtrax client | 1 | #build-m3 file for fishtrax client |
| 2 | 2 | ||
| 3 | execute("ln -sf parser.yy.c src/parser.yy.cpp"); | ||
| 4 | execute("ln -sf parser.tab.c src/parser.tab.cpp"); | ||
| 5 | |||
| 3 | action "default" | 6 | action "default" |
| 4 | { | 7 | { |
| 5 | warning "Use the 'release' target to strip debugging and build without deps."; | 8 | warning "Use the 'release' target to strip debugging and build without deps."; |
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 | ||
| 45 | int 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 | ||
| 20 | protected: | ||
| 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 |
