X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fengineer%2Foptions.cpp;h=0108ba5925e44d376d3244cc2418133e3e20578b;hb=abed4a255060d5a233ec0ac2dd60af9132e29201;hp=b5c36cd5409cca9e43822fda7215e9f1e9018b52;hpb=1ff06c5bc46a677fa389ef86c6b26664368f1653;p=r2c2.git diff --git a/source/engineer/options.cpp b/source/engineer/options.cpp index b5c36cd..0108ba5 100644 --- a/source/engineer/options.cpp +++ b/source/engineer/options.cpp @@ -1,10 +1,3 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #include #include #include @@ -20,7 +13,8 @@ Options::Options(int argc, char **argv): fullscreen(false), debug(false), network(false), - simulate(false) + simulate(false), + sim_speed(1.0f) { string res; @@ -30,8 +24,11 @@ Options::Options(int argc, char **argv): getopt.add_option('g', "debug", debug, GetOpt::NO_ARG); getopt.add_option('d', "driver", driver, GetOpt::REQUIRED_ARG); getopt.add_option('s', "simulate", simulate, GetOpt::NO_ARG); + 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_option( "uistate", uistate_fn, GetOpt::REQUIRED_ARG); + getopt.add_argument("layout", layout_fn, GetOpt::REQUIRED_ARG); getopt(argc, argv); if(!res.empty()) @@ -42,15 +39,12 @@ Options::Options(int argc, char **argv): screen_h = lexical_cast(m[2].str); } else - throw UsageError("Invalid resolution"); + throw usage_error("Invalid resolution"); } - const vector &args = getopt.get_args(); - if(args.empty()) - throw UsageError("No layout given"); - - layout_fn = args[0]; - if(state_fn.empty()) state_fn = FS::basepart(layout_fn)+".state"; + + if(uistate_fn.empty()) + uistate_fn = FS::basepart(layout_fn)+".uistate"; }