From 1e7b81e843b584381ed779996b3e7a20f3ec19ce Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 10 Apr 2014 00:23:42 +0300 Subject: [PATCH] Set speed slider range from the advertised top speed of the train --- source/engineer/traindialog.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/engineer/traindialog.cpp b/source/engineer/traindialog.cpp index f202377..432f3dd 100644 --- a/source/engineer/traindialog.cpp +++ b/source/engineer/traindialog.cpp @@ -33,6 +33,9 @@ TrainDialog::TrainDialog(Engineer &e, R2C2::Train &t): btn_expand->signal_clicked.connect(sigc::mem_fun(this, &TrainDialog::expand_clicked)); lbl_speed = dynamic_cast(get_item(widgets, "lbl_speed")); sld_speed = dynamic_cast(get_item(widgets, "sld_speed")); + float max_speed = train.get_maximum_speed(); + if(max_speed>0) + sld_speed->set_range(0, max_speed*3.6/train.get_layout().get_catalogue().get_scale()); sld_speed->signal_value_changed.connect(sigc::mem_fun(this, &TrainDialog::ui_speed_changed)); tgl_forward = dynamic_cast(get_item(widgets, "tgl_forward")); tgl_forward->signal_toggled.connect(sigc::mem_fun(this, &TrainDialog::ui_forward_toggled)); -- 2.45.2