]> git.tdb.fi Git - r2c2.git/commitdiff
Use add_argument instead of get_args
authorMikko Rasa <tdb@tdb.fi>
Fri, 27 Mar 2015 07:15:10 +0000 (09:15 +0200)
committerMikko Rasa <tdb@tdb.fi>
Fri, 27 Mar 2015 07:15:10 +0000 (09:15 +0200)
source/engineer/options.cpp

index bdac3619356bbc6b3a1c9558a4bce74b66f6cf65..7eabb8e2d288d2554c8fc254511ac775bba34a91 100644 (file)
@@ -27,6 +27,7 @@ Options::Options(int argc, char **argv):
        getopt.add_option(     "sim-speed",   sim_speed,   GetOpt::REQUIRED_ARG);
        getopt.add_option('n', "network",     network,     GetOpt::NO_ARG);
        getopt.add_option(     "state",       state_fn,    GetOpt::REQUIRED_ARG);
+       getopt.add_argument("layout", layout_fn, GetOpt::REQUIRED_ARG);
        getopt(argc, argv);
 
        if(!res.empty())
@@ -40,12 +41,6 @@ Options::Options(int argc, char **argv):
                        throw usage_error("Invalid resolution");
        }
 
-       const vector<string> &args = getopt.get_args();
-       if(args.empty())
-               throw usage_error("No layout given");
-
-       layout_fn = args[0];
-
        if(state_fn.empty())
                state_fn = FS::basepart(layout_fn)+".state";
 }