]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/options.cpp
Add an option to set simulation speed
[r2c2.git] / source / engineer / options.cpp
index fc7516c16cc2405d91c7e92cf0944d9be07400f3..bdac3619356bbc6b3a1c9558a4bce74b66f6cf65 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of the MSP Märklin suite
-Copyright © 2010  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #include <msp/core/getopt.h>
 #include <msp/fs/utils.h>
 #include <msp/strings/lexicalcast.h>
@@ -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,6 +24,7 @@ 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(argc, argv);
@@ -42,12 +37,12 @@ Options::Options(int argc, char **argv):
                        screen_h = lexical_cast<unsigned>(m[2].str);
                }
                else
-                       throw UsageError("Invalid resolution");
+                       throw usage_error("Invalid resolution");
        }
 
        const vector<string> &args = getopt.get_args();
        if(args.empty())
-               throw UsageError("No layout given");
+               throw usage_error("No layout given");
 
        layout_fn = args[0];