From: Mikko Rasa Date: Wed, 2 Apr 2014 20:15:49 +0000 (+0300) Subject: Instead of setting the speed of all locomotives, just enable halt mode X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=4d91e3e8374cd7ad927ce0d77a60498903b6e02a;p=r2c2.git Instead of setting the speed of all locomotives, just enable halt mode The old code was causing an exception and segfault with ArduControl, since locomotive IDs are not equal to their addresses. --- diff --git a/source/engineer/engineer.cpp b/source/engineer/engineer.cpp index 49edd48..19e515c 100644 --- a/source/engineer/engineer.cpp +++ b/source/engineer/engineer.cpp @@ -121,17 +121,15 @@ Engineer::Engineer(int argc, char **argv): Engineer::~Engineer() { - const map &trains = layout.get_trains(); - for(map::const_iterator i=trains.begin(); i!=trains.end(); ++i) - layout.get_driver().set_loco_speed(i->first, 0); - layout.get_driver().flush(); - if(!options.simulate) { layout.save_dynamic(options.state_fn+".tmp"); FS::rename(options.state_fn+".tmp", options.state_fn); } + layout.get_driver().halt(true); + layout.get_driver().flush(); + delete overlay; delete root_arrangement; delete root;