drp_priority->append("Unspecified");
drp_priority->append("Standard passenger");
drp_priority->append("Express passenger");
- drp_priority->set_selected_index(train->get_priority()+2);
if(train)
{
ent_addr->set_text(lexical_cast(train->get_address()));
ent_name->set_text(train->get_name());
+ drp_priority->set_selected_index(train->get_priority()+2);
}
else
+ {
ent_name->set_text(format("Train %d", engineer.get_layout().get_trains().size()+1));
+ drp_priority->set_selected_index(2);
+ }
}
void TrainProperties::on_ok_clicked()
#include <msp/core/refptr.h>
#include <msp/datafile/parser.h>
#include <msp/datafile/writer.h>
+#include <msp/io/print.h>
#include <msp/time/utils.h>
#include "block.h"
#include "catalogue.h"
{
if(driver)
driver->halt(true);
+ IO::print("Emergency: %s\n", msg);
signal_emergency.emit(msg);
}
if((*i)->get_sensor_id()==addr)
{
if(!(*i)->get_train())
- emergency("Unreserved sensor triggered");
+ emergency(format("Unreserved sensor %d triggered", addr));
break;
}
}
if(pure_speed)
{
- RealSpeed &rs = real_speed[current_speed];
- rs.add(travel_dist/travel_time_secs, travel_time_secs);
+ if(current_speed)
+ {
+ RealSpeed &rs = real_speed[current_speed];
+ rs.add(travel_dist/travel_time_secs, travel_time_secs);
+ }
set_status(format("Traveling %d kmh", get_travel_speed()));
}
unsigned Train::reserve_more()
{
if(!active)
- return;
+ return 0;
BlockRef *last = 0;
if(!rsv_blocks.empty())
if(!high)
{
if(!low)
- return 0;
+ {
+ if(real)
+ return 3;
+ else
+ return 0;
+ }
return min(static_cast<unsigned>(low*real/real_speed[low].speed), 14U);
}