The old code was causing an exception and segfault with ArduControl,
since locomotive IDs are not equal to their addresses.
Engineer::~Engineer()
{
- const map<unsigned, Train *> &trains = layout.get_trains();
- for(map<unsigned, Train *>::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;