X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fengineer%2Fnewtraindialog.cpp;h=e0b4e1a279a4c51d7e3c396ad9ad392783cd3682;hb=81ee4fbd16b472892b67b35ea85956423a2247ed;hp=006a819b50d5a631ee86ef945858e4e709c92e5a;hpb=7c98e23312cf01ce1fa6c1ffd8e36c22d2fa6110;p=r2c2.git diff --git a/source/engineer/newtraindialog.cpp b/source/engineer/newtraindialog.cpp index 006a819..e0b4e1a 100644 --- a/source/engineer/newtraindialog.cpp +++ b/source/engineer/newtraindialog.cpp @@ -42,11 +42,17 @@ NewTrainDialog::NewTrainDialog(Engineer &e): drp_protocol->set_selected_index(0); - const Catalogue::ObjectMap &obj_types = engineer.get_layout().get_catalogue().get_all(); - for(Catalogue::ObjectMap::const_iterator i=obj_types.begin(); i!=obj_types.end(); ++i) - if(const VehicleType *vt = dynamic_cast(i->second)) - if(vt->is_locomotive()) - loco_types.append(vt); + list veh_types = engineer.get_layout().get_catalogue().get_list(); + for(list::iterator i=veh_types.begin(); i!=veh_types.end(); ++i) + if((*i)->is_locomotive()) + loco_types.append(*i); +} + +void NewTrainDialog::prefill(const Driver::DetectedLocomotive &loco) +{ + drp_protocol->set_selected_index(protocols.find(loco.protocol)); + ent_address->set_text(lexical_cast(loco.address)); + ent_name->set_text(loco.name); } void NewTrainDialog::on_response(int code)