]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/trainproperties.cpp
Don't clear timetable before all rows are successfully parsed
[r2c2.git] / source / engineer / trainproperties.cpp
index 96c8313d4800d2809cf5da62021d5f1d9a4ab5a8..4596000724a204bff97b9c53a685d973318cf511 100644 (file)
@@ -23,7 +23,7 @@ TrainProperties::TrainProperties(Engineer &e, const GLtk::Resources &r, Train *t
        engineer(e),
        train(t)
 {
-       set_size(200, 120);
+       set_size(200, 145);
 
        GLtk::Label *label;
        add(*(label=new GLtk::Label(res, "Train properties")));
@@ -50,13 +50,25 @@ TrainProperties::TrainProperties(Engineer &e, const GLtk::Resources &r, Train *t
        add(*(ent_name=new GLtk::Entry(res)));
        ent_name->set_geometry(GLtk::Geometry(10, geom.h-75, geom.w-20, 20));
 
+       add(*(drp_priority=new GLtk::Dropdown(res)));
+       drp_priority->set_geometry(GLtk::Geometry(10, geom.h-100, geom.w-20, 20));
+       drp_priority->append("Standard freight");
+       drp_priority->append("Express freight");
+       drp_priority->append("Unspecified");
+       drp_priority->append("Standard passenger");
+       drp_priority->append("Express passenger");
+
        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()
@@ -80,4 +92,5 @@ void TrainProperties::on_ok_clicked()
        }
 
        train->set_name(ent_name->get_text());
+       train->set_priority(drp_priority->get_selected_index()-2);
 }