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. --- default.bld | 9 +++++++++ mingw.bld | 3 +++ src/main.cpp | 7 ++++++- src/options.cpp | 8 ++++++++ src/options.h | 2 ++ 5 files changed, 28 insertions(+), 1 deletion(-) diff --git a/default.bld b/default.bld index f36c76b..bacbb6b 100644 --- a/default.bld +++ b/default.bld @@ -1,4 +1,13 @@ +if exists("src/parser.yy.cpp") then +{ + unlink("src/parser.yy.cpp"); +} +if exists("src/parser.tab.cpp") then +{ + unlink("src/parser.tab.cpp"); +} + action "default" { build: ["src/version.h", "stage"]; diff --git a/mingw.bld b/mingw.bld index f224fa0..88311e2 100644 --- a/mingw.bld +++ b/mingw.bld @@ -1,5 +1,8 @@ #build-m3 file for fishtrax client +execute("ln -sf parser.yy.c src/parser.yy.cpp"); +execute("ln -sf parser.tab.c src/parser.tab.cpp"); + action "default" { 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[] ) 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