layout.add_train(*this);
- layout.get_driver().add_loco(address, protocol);
+ layout.get_driver().add_loco(address, protocol, loco_type);
layout.get_driver().signal_loco_speed.connect(sigc::mem_fun(this, &Train::loco_speed_event));
layout.get_driver().signal_loco_function.connect(sigc::mem_fun(this, &Train::loco_func_event));
{
if(!loco_type.get_functions().count(func))
throw InvalidParameterValue("Invalid function");
- if(func<5)
- layout.get_driver().set_loco_function(address, func, state);
- else
- layout.get_driver().set_loco_function(address+1, func-4, state);
+ layout.get_driver().set_loco_function(address, func, state);
}
float Train::get_control(const string &ctrl) const
void Train::loco_func_event(unsigned addr, unsigned func, bool state)
{
- if(addr==address || (addr==address+1 && loco_type.get_max_function()>4))
+ if(addr==address)
{
- if(addr==address+1)
- func += 4;
if(state)
functions |= 1<<func;
else