]> git.tdb.fi Git - r2c2.git/commitdiff
Use generic ObjectTypes in Catalogue
authorMikko Rasa <tdb@tdb.fi>
Fri, 30 Aug 2013 19:18:47 +0000 (22:18 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 30 Aug 2013 19:18:47 +0000 (22:18 +0300)
21 files changed:
source/3d/catalogue.cpp
source/3d/catalogue.h
source/3d/objecttype.h [new file with mode: 0644]
source/3d/signal.cpp
source/3d/signaltype.cpp
source/3d/signaltype.h
source/3d/track.cpp
source/3d/tracktype.cpp
source/3d/tracktype.h
source/3d/typemap.h
source/3d/vehicle.cpp
source/3d/vehicletype.cpp
source/3d/vehicletype.h
source/designer/extendtool.cpp
source/engineer/newtraindialog.cpp
source/engineer/newvehicledialog.cpp
source/libr2c2/catalogue.cpp
source/libr2c2/catalogue.h
source/libr2c2/layout.cpp
source/libr2c2/train.cpp
source/network/train.cpp

index 4d7b4a83fea5f3835221198004c6b28dd9c80e37..9daa7c809c7421dc71b9a68e2e044107358d7750 100644 (file)
@@ -23,58 +23,34 @@ Catalogue3D::Catalogue3D(Catalogue &c):
        add_type<GL::Program>().creator(&Catalogue3D::create<GL::Program>);
        add_type<GL::Technique>().creator(&Catalogue3D::create<GL::Technique>);
 
-       catalogue.signal_track_added.connect(sigc::mem_fun(this, &Catalogue3D::track_added));
-       catalogue.signal_vehicle_added.connect(sigc::mem_fun(this, &Catalogue3D::vehicle_added));
-       catalogue.signal_signal_added.connect(sigc::mem_fun(this, &Catalogue3D::signal_added));
+       catalogue.signal_object_added.connect(sigc::mem_fun(this, &Catalogue3D::object_added));
 
-       const Catalogue::TrackMap &trks = catalogue.get_tracks();
-       for(Catalogue::TrackMap::const_iterator i=trks.begin(); i!=trks.end(); ++i)
-               track_added(*i->second);
-       const Catalogue::SignalMap &sigs = catalogue.get_signals();
-       for(Catalogue::SignalMap::const_iterator i=sigs.begin(); i!=sigs.end(); ++i)
-               signal_added(*i->second);
+       const Catalogue::ObjectMap &objs = catalogue.get_all();
+       for(Catalogue::ObjectMap::const_iterator i=objs.begin(); i!=objs.end(); ++i)
+               object_added(*i->second);
 
        build_endpoint_mesh();
 }
 
 Catalogue3D::~Catalogue3D()
 {
-       for(map<const TrackType *, TrackType3D *>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
+       for(map<const ObjectType *, ObjectType3D *>::iterator i=objects.begin(); i!=objects.end(); ++i)
                delete i->second;
-       for(map<const VehicleType *, VehicleType3D *>::iterator i=vehicles.begin(); i!=vehicles.end(); ++i)
-               delete i->second;
-       for(map<const SignalType *, SignalType3D *>::iterator i=signals.begin(); i!=signals.end(); ++i)
-               delete i->second;
-}
-
-const TrackType3D &Catalogue3D::get_track(const TrackType &tt) const
-{
-       return *get_item(tracks, &tt);
-}
-
-const VehicleType3D &Catalogue3D::get_vehicle(const VehicleType &vt) const
-{
-       return *get_item(vehicles, &vt);
-}
-
-const SignalType3D &Catalogue3D::get_signal(const SignalType &vt) const
-{
-       return *get_item(signals, &vt);
-}
-
-void Catalogue3D::track_added(const TrackType &track)
-{
-       tracks[&track] = new TrackType3D(*this, track);
 }
 
-void Catalogue3D::vehicle_added(const VehicleType &veh)
+void Catalogue3D::object_added(const ObjectType &ot)
 {
-       vehicles[&veh] = new VehicleType3D(*this, veh);
+       if(const TrackType *tt = dynamic_cast<const TrackType *>(&ot))
+               objects[&ot] = new TrackType3D(*this, *tt);
+       else if(const SignalType *st = dynamic_cast<const SignalType *>(&ot))
+               objects[&ot] = new SignalType3D(*this, *st);
+       else if(const VehicleType *vt = dynamic_cast<const VehicleType *>(&ot))
+               objects[&ot] = new VehicleType3D(*this, *vt);
 }
 
-void Catalogue3D::signal_added(const SignalType &sig)
+const ObjectType3D &Catalogue3D::get_3d(const ObjectType &ot) const
 {
-       signals[&sig] = new SignalType3D(*this, sig);
+       return *get_item(objects, &ot);
 }
 
 void Catalogue3D::build_endpoint_mesh()
index ecac7ddca27b97ca05ac3a71c8c37fecdb0fd56f..1cc096a67b9588ca3dbffb5867f43bc0129695aa 100644 (file)
@@ -6,20 +6,17 @@
 #include <msp/gl/material.h>
 #include <msp/gl/mesh.h>
 #include "libr2c2/catalogue.h"
+#include "typemap.h"
 
 namespace R2C2 {
 
-class SignalType3D;
-class TrackType3D;
-class VehicleType3D;
+class ObjectType3D;
 
 class Catalogue3D: public Msp::DataFile::Collection
 {
 private:
        Catalogue &catalogue;
-       std::map<const TrackType *, TrackType3D *> tracks;
-       std::map<const VehicleType *, VehicleType3D *> vehicles;
-       std::map<const SignalType *, SignalType3D *> signals;
+       std::map<const ObjectType *, ObjectType3D *> objects;
        Msp::GL::Mesh endpoint_mesh;
 
 public:
@@ -27,16 +24,21 @@ public:
        ~Catalogue3D();
 
        const Catalogue &get_catalogue() const { return catalogue; }
-       const TrackType3D &get_track(const TrackType &) const;
-       const VehicleType3D &get_vehicle(const VehicleType &) const;
-       const SignalType3D &get_signal(const SignalType &) const;
-       const Msp::GL::Mesh &get_endpoint_mesh() const { return endpoint_mesh; }
 private:
-       void track_added(const TrackType &);
-       void vehicle_added(const VehicleType &);
-       void signal_added(const SignalType &);
+       void object_added(const ObjectType &);
+public:
+       const ObjectType3D &get_3d(const ObjectType &) const;
+
+       template<typename T>
+       const typename TypeMap3D<T>::Type3D &get_3d(const T &ot) const
+       { return dynamic_cast<const typename TypeMap3D<T>::Type3D &>(get_3d(static_cast<const ObjectType &>(ot))); }
+
+private:
        void build_endpoint_mesh();
+public:
+       const Msp::GL::Mesh &get_endpoint_mesh() const { return endpoint_mesh; }
 
+private:
        Msp::FS::Path locate_file(const std::string &);
 
        template<typename T>
diff --git a/source/3d/objecttype.h b/source/3d/objecttype.h
new file mode 100644 (file)
index 0000000..2b1a833
--- /dev/null
@@ -0,0 +1,20 @@
+#ifndef R2C2_3D_OBJECTTYPE_H_
+#define R2C2_3D_OBJECTTYPE_H_
+
+namespace R2C2 {
+
+class Catalogue3D;
+
+class ObjectType3D
+{
+protected:
+       Catalogue3D &catalogue;
+
+       ObjectType3D(Catalogue3D &c): catalogue(c) { }
+public:
+       virtual ~ObjectType3D() { }
+};
+
+} // namespace R2C2
+
+#endif
index 5872dc850785c6f87294272898b934c7ec188fb1..2e4a1120b217930288f21ed2c60b7459c89eae40 100644 (file)
@@ -10,7 +10,7 @@ namespace R2C2 {
 
 Signal3D::Signal3D(Layout3D &l, Signal &s):
        Object3D(l, s),
-       GL::ObjectInstance(l.get_catalogue().get_signal(s.get_type()).get_object()),
+       GL::ObjectInstance(l.get_catalogue().get_3d(s.get_type()).get_object()),
        signal(s)
 {
        layout.get_scene().add(*this);
index e5f36a96001bb0bc8f6d9b7bba7d0a437fac6912..1843e00bc6b8bf6df3153052ffaacc743a47b1c4 100644 (file)
@@ -6,7 +6,7 @@ using namespace Msp;
 namespace R2C2 {
 
 SignalType3D::SignalType3D(Catalogue3D &c, const SignalType &type):
-       catalogue(c),
+       ObjectType3D(c),
        object(catalogue.get<GL::Object>(type.get_object()))
 { }
 
index 7ec360bee08952a880ff100e971bf319b09c22dd..2f886239785091230d7f06298470677b2f749603 100644 (file)
@@ -3,15 +3,13 @@
 
 #include <msp/gl/object.h>
 #include "libr2c2/signaltype.h"
+#include "objecttype.h"
 
 namespace R2C2 {
 
-class Catalogue3D;
-
-class SignalType3D
+class SignalType3D: public ObjectType3D
 {
 private:
-       Catalogue3D &catalogue;
        Msp::GL::Object &object;
 
 public:
index ee7671c8886ef337e6fee36ebe9d05d3d2b9b0e1..549bc156ba6dce2de6babcb6db4889441ce4b221 100644 (file)
@@ -15,9 +15,9 @@ namespace R2C2 {
 
 Track3D::Track3D(Layout3D &l, Track &t):
        Object3D(l, t),
-       GL::ObjectInstance(l.get_catalogue().get_track(t.get_type()).get_object()),
+       GL::ObjectInstance(l.get_catalogue().get_3d(t.get_type()).get_object()),
        track(t),
-       type(layout.get_catalogue().get_track(track.get_type()))
+       type(layout.get_catalogue().get_3d(track.get_type()))
 {
        layout.get_scene().add(*this);
 
index 31751f9e3a387797a4dd8a0c18b6230247dfa4fd..d73387c998dbbece809ef234767e77ff8a4b5802 100644 (file)
@@ -9,13 +9,13 @@ using namespace Msp;
 
 namespace R2C2 {
 
-TrackType3D::TrackType3D(Catalogue3D &cat3d, const TrackType &tt):
-       catalogue(cat3d),
+TrackType3D::TrackType3D(Catalogue3D &c, const TrackType &tt):
+       ObjectType3D(c),
        mesh(0),
        object(0),
        own_data(false)
 {
-       const Catalogue &cat = cat3d.get_catalogue();
+       const Catalogue &cat = catalogue.get_catalogue();
        const vector<TrackPart> &parts = tt.get_parts();
 
        const Profile &ballast_profile = cat.get_ballast_profile();
index 27bf7fe97723ec8e9e0c39d2f4b63ade8bcd0c89..6cde93eb13b41f6501a0eeb3b1c0edf1a66a9d67 100644 (file)
@@ -7,15 +7,13 @@
 #include <msp/gl/object.h>
 #include "libr2c2/profile.h"
 #include "libr2c2/tracktype.h"
+#include "objecttype.h"
 
 namespace R2C2 {
 
-class Catalogue3D;
-
-class TrackType3D
+class TrackType3D: public ObjectType3D
 {
 private:
-       Catalogue3D &catalogue;
        Msp::GL::Mesh *mesh;
        Msp::GL::Object *object;
        bool own_data;
index 84a3eeb9b070d3b1170dfea20533e8ccfd376cf3..2772b1f7c573a82d18ec4b7e759de6ce640f0fcb 100644 (file)
@@ -3,8 +3,11 @@
 
 #include <msp/core/meta.h>
 #include "signal.h"
+#include "signaltype.h"
 #include "track.h"
+#include "tracktype.h"
 #include "vehicle.h"
+#include "vehicletype.h"
 
 namespace R2C2 {
 
@@ -16,8 +19,11 @@ struct TypeMap3D<const T>: TypeMap3D<T>
 { };
 
 template<> struct TypeMap3D<Signal> { typedef Signal3D Type3D; };
+template<> struct TypeMap3D<SignalType> { typedef SignalType3D Type3D; };
 template<> struct TypeMap3D<Track> { typedef Track3D Type3D; };
+template<> struct TypeMap3D<TrackType> { typedef TrackType3D Type3D; };
 template<> struct TypeMap3D<Vehicle> { typedef Vehicle3D Type3D; };
+template<> struct TypeMap3D<VehicleType> { typedef VehicleType3D Type3D; };
 
 } // namespace R2C2
 
index fa1d751c7e20cb297a7b665cc34e55123b4b199c..5843c17998363f391025ecda5ba744726dd9fcaf 100644 (file)
@@ -15,9 +15,9 @@ namespace R2C2 {
 
 Vehicle3D::Vehicle3D(Layout3D &l, Vehicle &v):
        Object3D(l, v),
-       GL::ObjectInstance(*l.get_catalogue().get_vehicle(v.get_type()).get_body_object()),
+       GL::ObjectInstance(*l.get_catalogue().get_3d(v.get_type()).get_body_object()),
        vehicle(v),
-       type(layout.get_catalogue().get_vehicle(vehicle.get_type()))
+       type(layout.get_catalogue().get_3d(vehicle.get_type()))
 {
        unsigned n_axles = vehicle.get_type().get_axles().size();
        for(unsigned i=0; i<n_axles; ++i)
index 4c885174021695e7fd66b6d1a25ade0fbeaef255..c6636099b0e8e9595f78405f5b800fe4b3641b7e 100644 (file)
@@ -25,7 +25,7 @@ T get(const map<string, string> &params, const string &key, T def = T())
 namespace R2C2 {
 
 VehicleType3D::VehicleType3D(Catalogue3D &c, const VehicleType &t):
-       catalogue(c),
+       ObjectType3D(c),
        type(t),
        body_object(0)
 {
index 81a6468b81622470a5605f87f86e71a7f2a0df6e..02d110887a6b729f94f2930b1d86f0dbbf94e107 100644 (file)
@@ -4,15 +4,13 @@
 #include <msp/gl/mesh.h>
 #include <msp/gl/object.h>
 #include "libr2c2/vehicletype.h"
+#include "objecttype.h"
 
 namespace R2C2 {
 
-class Catalogue3D;
-
-class VehicleType3D
+class VehicleType3D: public ObjectType3D
 {
 private:
-       Catalogue3D &catalogue;
        const VehicleType &type;
        std::map<std::string, Msp::GL::Object *> objects;
        Msp::GL::Object *body_object;
index 3af4cf6cd0b1398f719e79346e3151794ff52939..2a66181f32772c44557aef23fc64cd3479a65c27 100644 (file)
@@ -154,20 +154,21 @@ void ExtendTool::finish()
 
 vector<Track *> ExtendTool::create_straight(const Vector &start, const Angle &dir, float length, float limit)
 {
-       const Catalogue::TrackMap &track_types = designer.get_catalogue().get_tracks();
+       const Catalogue::ObjectMap &object_types = designer.get_catalogue().get_all();
        map<float, const TrackType *> types_by_length;
        unsigned preference = 0;
-       for(Catalogue::TrackMap::const_iterator i=track_types.begin(); i!=track_types.end(); ++i)
-       {
-               const vector<TrackPart> &parts = i->second->get_parts();
-               if(parts.size()!=1)
-                       continue;
-               if(parts.front().is_curved() || parts.front().is_dead_end())
-                       continue;
+       for(Catalogue::ObjectMap::const_iterator i=object_types.begin(); i!=object_types.end(); ++i)
+               if(const TrackType *tt = dynamic_cast<const TrackType *>(i->second))
+               {
+                       const vector<TrackPart> &parts = tt->get_parts();
+                       if(parts.size()!=1)
+                               continue;
+                       if(parts.front().is_curved() || parts.front().is_dead_end())
+                               continue;
 
-               types_by_length[parts.front().get_length()] = i->second;
-               preference = max(preference, i->second->get_autofit_preference());
-       }
+                       types_by_length[parts.front().get_length()] = tt;
+                       preference = max(preference, tt->get_autofit_preference());
+               }
 
        vector<float> lengths;
        float removed = 0;
index 78a3f113b6b0a161ed1ea96e2d6ddddb83a28f60..006a819b50d5a631ee86ef945858e4e709c92e5a 100644 (file)
@@ -42,10 +42,11 @@ NewTrainDialog::NewTrainDialog(Engineer &e):
 
        drp_protocol->set_selected_index(0);
 
-       const Catalogue::VehicleMap &cat_vtypes = engineer.get_layout().get_catalogue().get_vehicles();
-       for(Catalogue::VehicleMap::const_iterator i=cat_vtypes.begin(); i!=cat_vtypes.end(); ++i)
-               if(i->second->is_locomotive())
-                       loco_types.append(i->second);
+       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);
 }
 
 void NewTrainDialog::on_response(int code)
index f27370fe093bdba68228ddc843c5d7c0bb9feef3..de4d14a7fda8786679bdfaff10bab774dea8402d 100644 (file)
@@ -37,14 +37,15 @@ NewVehicleDialog::NewVehicleDialog(Train &t):
 
        dynamic_cast<GLtk::Button *>(get_item(widgets, "btn_add"))->signal_clicked.connect(sigc::mem_fun(this, &NewVehicleDialog::add_clicked));
 
-       const Catalogue::VehicleMap &cat_vtypes = train.get_layout().get_catalogue().get_vehicles();
-       for(Catalogue::VehicleMap::const_iterator i=cat_vtypes.begin(); i!=cat_vtypes.end(); ++i)
-       {
-               if(i->second->is_locomotive())
-                       loco_types.append(i->second);
-               else
-                       wagon_types.append(i->second);
-       }
+       const Catalogue::ObjectMap &obj_types = train.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);
+                       else
+                               wagon_types.append(vt);
+               }
 }
 
 void NewVehicleDialog::toggle_list(bool show, GLtk::List *lst)
index ab268cd84eeb2bc7a47a72d7665ee034c7537c8c..221a6f0663667cca1665e4388d867e422c16fb5e 100644 (file)
@@ -19,11 +19,7 @@ Catalogue::Catalogue():
 
 Catalogue::~Catalogue()
 {
-       for(TrackMap::iterator i=tracks.begin(); i!=tracks.end(); ++i)
-               delete i->second;
-       for(SignalMap::iterator i=signals.begin(); i!=signals.end(); ++i)
-               delete i->second;
-       for(VehicleMap::iterator i=vehicles.begin(); i!=vehicles.end(); ++i)
+       for(ObjectMap::iterator i=objects.begin(); i!=objects.end(); ++i)
                delete i->second;
 }
 
@@ -32,37 +28,15 @@ float Catalogue::get_rail_elevation() const
        return ballast_profile.get_height()+rail_profile.get_height();
 }
 
-void Catalogue::add_track(TrackType &track)
-{
-       insert_unique(tracks, track.get_article_number(), &track);
-       signal_track_added.emit(track);
-}
-
-const TrackType &Catalogue::get_track(const ArticleNumber &art_nr) const
-{
-       return *get_item(tracks, art_nr);
-}
-
-void Catalogue::add_vehicle(VehicleType &veh)
-{
-       insert_unique(vehicles, veh.get_article_number(), &veh);
-       signal_vehicle_added.emit(veh);
-}
-
-const VehicleType &Catalogue::get_vehicle(const ArticleNumber &art_nr) const
-{
-       return *get_item(vehicles, art_nr);
-}
-
-void Catalogue::add_signal(SignalType &sig)
+void Catalogue::add(ObjectType &object)
 {
-       insert_unique(signals, sig.get_article_number(), &sig);
-       signal_signal_added.emit(sig);
+       insert_unique(objects, object.get_article_number(), &object);
+       signal_object_added.emit(object);
 }
 
-const SignalType &Catalogue::get_signal(const ArticleNumber &art_nr) const
+const ObjectType &Catalogue::get(const ArticleNumber &art_nr) const
 {
-       return *get_item(signals, art_nr);
+       return *get_item(objects, art_nr);
 }
 
 
@@ -107,32 +81,32 @@ void Catalogue::Loader::scale(float n, float d)
 
 void Catalogue::Loader::signal(ArticleNumber art_nr)
 {
-       if(obj.signals.count(art_nr))
+       if(obj.objects.count(art_nr))
                throw key_error(art_nr);
 
        RefPtr<SignalType> sig = new SignalType(art_nr);
        load_sub(*sig);
-       obj.add_signal(*sig.release());
+       obj.add(*sig.release());
 }
 
 void Catalogue::Loader::track(ArticleNumber art_nr)
 {
-       if(obj.tracks.count(art_nr))
+       if(obj.objects.count(art_nr))
                throw key_error(art_nr);
 
        RefPtr<TrackType> trk = new TrackType(art_nr);
        load_sub(*trk);
-       obj.add_track(*trk.release());
+       obj.add(*trk.release());
 }
 
 void Catalogue::Loader::vehicle(ArticleNumber art_nr)
 {
-       if(obj.vehicles.count(art_nr))
+       if(obj.objects.count(art_nr))
                throw key_error(art_nr);
 
        RefPtr<VehicleType> veh = new VehicleType(art_nr);
        load_sub(*veh);
-       obj.add_vehicle(*veh.release());
+       obj.add(*veh.release());
 }
 
 } // namespace R2C2
index d13c9821d67cad4c3cc09fcb4d42e57902cdb52a..dcde9f38f9600dfac5a2a7f761e72ec0c54738c5 100644 (file)
@@ -9,9 +9,7 @@
 
 namespace R2C2 {
 
-class SignalType;
-class TrackType;
-class VehicleType;
+class ObjectType;
 
 class Catalogue
 {
@@ -31,13 +29,9 @@ public:
                void vehicle(ArticleNumber);
        };
 
-       typedef std::map<ArticleNumber, TrackType *> TrackMap;
-       typedef std::map<ArticleNumber, VehicleType *> VehicleMap;
-       typedef std::map<ArticleNumber, SignalType *> SignalMap;
+       typedef std::map<ArticleNumber, ObjectType *> ObjectMap;
 
-       sigc::signal<void, const TrackType &> signal_track_added;
-       sigc::signal<void, const VehicleType &> signal_vehicle_added;
-       sigc::signal<void, const SignalType &> signal_signal_added;
+       sigc::signal<void, const ObjectType &> signal_object_added;
 
 private:
        float scale;
@@ -45,9 +39,7 @@ private:
        Profile rail_profile;
        Profile ballast_profile;
        std::string track_technique;
-       TrackMap tracks;
-       VehicleMap vehicles;
-       SignalMap signals;
+       ObjectMap objects;
        Layout layout;
 
 public:
@@ -61,17 +53,13 @@ public:
        const Profile &get_ballast_profile() const { return ballast_profile; }
        const std::string &get_track_technique() const { return track_technique; }
 
-       void add_track(TrackType &);
-       const TrackType &get_track(const ArticleNumber &) const;
-       const TrackMap &get_tracks() const { return tracks; }
+       void add(ObjectType &);
+       const ObjectType &get(const ArticleNumber &) const;
+       const ObjectMap &get_all() const { return objects; }
 
-       void add_vehicle(VehicleType &);
-       const VehicleType &get_vehicle(const ArticleNumber &) const;
-       const VehicleMap &get_vehicles() const { return vehicles; }
-
-       void add_signal(SignalType &);
-       const SignalType &get_signal(const ArticleNumber &) const;
-       const SignalMap &get_signals() const { return signals; }
+       template<typename T>
+       const T &get(const ArticleNumber &an) const
+       { return dynamic_cast<const T &>(get(an)); }
 
        Layout &get_layout() { return layout; }
 };
index f318958879ba16049741222428fa8cc32412de34..598bf82bcf4c0a1763a22d9b78562b21c4d6e00e 100644 (file)
@@ -555,13 +555,13 @@ void Layout::Loader::route()
 
 void Layout::Loader::signal(ArticleNumber art_nr)
 {
-       Signal *sig = new Signal(obj, obj.catalogue.get_signal(art_nr));
+       Signal *sig = new Signal(obj, obj.catalogue.get<SignalType>(art_nr));
        load_sub(*sig);
 }
 
 void Layout::Loader::track(ArticleNumber art_nr)
 {
-       Track *trk = new Track(obj, obj.catalogue.get_track(art_nr));
+       Track *trk = new Track(obj, obj.catalogue.get<TrackType>(art_nr));
        load_sub(*trk);
        new_tracks = true;
        const set<Track *> &tracks = obj.objects.get<Track>();
@@ -572,7 +572,7 @@ void Layout::Loader::track(ArticleNumber art_nr)
 
 void Layout::Loader::train(ArticleNumber art_nr, unsigned addr, const std::string &proto)
 {
-       Train *trn = new Train(obj, obj.catalogue.get_vehicle(art_nr), addr, proto);
+       Train *trn = new Train(obj, obj.catalogue.get<VehicleType>(art_nr), addr, proto);
        load_sub(*trn);
 }
 
index 7e4a6904610a7b51ee19940e7f4d9cc1812f95aa..b1664633bc75e06dbb13fbcb92b1fadcea8945f5 100644 (file)
@@ -602,7 +602,7 @@ void Train::Loader::router()
 
 void Train::Loader::vehicle(ArticleNumber art_nr)
 {
-       const VehicleType &vtype = obj.layout.get_catalogue().get_vehicle(art_nr);
+       const VehicleType &vtype = obj.layout.get_catalogue().get<VehicleType>(art_nr);
        Vehicle *veh = new Vehicle(obj.layout, vtype);
        obj.vehicles.back()->attach_back(*veh);
        obj.vehicles.push_back(veh);
index eb9563786aa982bd08eb299ae7e2252555cbc909..4ba4df08870891e354c10c86489bc3c82a0290ac 100644 (file)
@@ -7,7 +7,7 @@ namespace R2C2 {
 
 NetTrain::NetTrain(Client &c, const TrainInfoPacket &pkt):
        client(c),
-       loco_type(client.get_catalogue().get_vehicle(pkt.loco_type)),
+       loco_type(client.get_catalogue().get<VehicleType>(pkt.loco_type)),
        address(pkt.address),
        name(pkt.name),
        functions(0)