]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/trainpanel.cpp
Forgot to add the new files
[r2c2.git] / source / engineer / trainpanel.cpp
index 250b283c23990ead07f5e8114f3f057f7d39e567..339f4eca669f7e9d4337dd25ab674c4937a260c7 100644 (file)
@@ -52,7 +52,8 @@ TrainPanel::TrainPanel(Engineer &e, const GLtk::Resources &r, Train &t):
        tgl_forward->signal_toggled.connect(sigc::mem_fun(this, &TrainPanel::forward_toggled));
        train.get_locomotive().signal_reverse_changed.connect(sigc::mem_fun(this, &TrainPanel::train_reverse_changed));
 
-       add(*(lbl_route=new GLtk::Label(res, "Free run")));
+       const Route *route = train.get_route();
+       add(*(lbl_route=new GLtk::Label(res, (route ? route->get_name() : "Free run"))));
        lbl_route->set_style("digital");
        lbl_route->set_geometry(GLtk::Geometry(10, 58, geom.w-20, 24));
        train.signal_route_changed.connect(sigc::mem_fun(this, &TrainPanel::train_route_changed));
@@ -64,14 +65,14 @@ TrainPanel::TrainPanel(Engineer &e, const GLtk::Resources &r, Train &t):
 
        const map<unsigned, string> &funcs = train.get_locomotive().get_type().get_functions();
        unsigned x = 10;
-       for(map<unsigned, string>::const_iterator i=funcs.begin(); i!=funcs.end(); ++i, x+=35)
+       for(map<unsigned, string>::const_iterator i=funcs.begin(); i!=funcs.end(); ++i, x+=36)
        {
                string fname = i->second;
                fname[0] = toupper(fname[0]);
                GLtk::Toggle *tgl;
                add(*(tgl=new GLtk::Toggle(res)));
                tgl->set_text(fname);
-               tgl->set_geometry(GLtk::Geometry(x, geom.h-85, 35, 27));
+               tgl->set_geometry(GLtk::Geometry(x, geom.h-85, 36, 27));
                tgl->set_value(train.get_locomotive().get_function(i->first));
                tgl->signal_toggled.connect(sigc::bind(sigc::mem_fun(this, &TrainPanel::func_toggled), i->first));