1 #include <msp/strings/format.h>
5 #include "trainstatus.h"
12 TrainStatus::TrainStatus(Train &t):
19 void TrainStatus::tick(const Time::TimeDelta &)
24 void TrainStatus::check()
26 float scale = train.get_layout().get_catalogue().get_scale();
27 int s = static_cast<int>(train.get_quantized_speed()*3.6/scale+0.5);
28 if(s==0 && train.get_block_allocator().is_active())
35 status = format("Traveling %d kmh", s);
36 if(unsigned step = train.get_speed_step())
37 status += format(" (%d)", step);
41 else if(!train.get_vehicle(0).is_placed())
48 signal_changed.emit(status);
49 signal_event.emit(Message("status-changed", status));