]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/newtraindialog.cpp
Convert Catalogue to a Collection
[r2c2.git] / source / engineer / newtraindialog.cpp
index ef9fbf82b6dfe79a58924f65f5e34b610b31acd2..e0b4e1a279a4c51d7e3c396ad9ad392783cd3682 100644 (file)
@@ -42,11 +42,10 @@ 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<const VehicleType *>(i->second))
-                       if(vt->is_locomotive())
-                               loco_types.append(vt);
+       list<VehicleType *> veh_types = engineer.get_layout().get_catalogue().get_list<VehicleType>();
+       for(list<VehicleType *>::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)