layout.signal_block_reserved.connect(sigc::mem_fun(this, &Engineer::block_reserved));
layout.signal_emergency.connect(sigc::mem_fun(this, &Engineer::set_status));
layout.get_driver().signal_sensor.connect(sigc::mem_fun(this, &Engineer::sensor_event));
- if(FS::exists("engineer.state"))
- DataFile::load(layout, "engineer.state");
+ if(FS::exists(options.state_fn))
+ DataFile::load(layout, options.state_fn);
if(options.network)
{
layout.get_driver().flush();
if(!options.simulate)
- layout.save_trains("engineer.state");
+ layout.save_trains(options.state_fn);
delete overlay;
delete root;
*/
#include <msp/core/getopt.h>
+#include <msp/fs/utils.h>
#include <msp/strings/lexicalcast.h>
#include <msp/strings/regex.h>
#include "options.h"
getopt.add_option('d', "driver", driver, GetOpt::REQUIRED_ARG);
getopt.add_option('s', "simulate", simulate, GetOpt::NO_ARG);
getopt.add_option('n', "network", network, GetOpt::NO_ARG);
+ getopt.add_option( "state", state_fn, GetOpt::REQUIRED_ARG);
getopt(argc, argv);
if(!res.empty())
throw UsageError("No layout given");
layout_fn = args[0];
+
+ if(state_fn.empty())
+ state_fn = FS::basepart(layout_fn)+".state";
}