X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Fcatalogue.cpp;h=beab69a62ae387cf37b54745518472ac14ee0ef9;hb=97443d96ff3ce51388d2edd1e0dca8f2cd231346;hp=286407cc09326818973d5a7c18593ac81108efb9;hpb=6968273080fa2a1cbcfc506610d5f249299611e9;p=r2c2.git diff --git a/source/libmarklin/catalogue.cpp b/source/libmarklin/catalogue.cpp index 286407c..beab69a 100644 --- a/source/libmarklin/catalogue.cpp +++ b/source/libmarklin/catalogue.cpp @@ -8,8 +8,8 @@ Distributed under the GPL #include #include #include "catalogue.h" -#include "locotype.h" #include "tracktype.h" +#include "vehicletype.h" using namespace std; using namespace Msp; @@ -30,6 +30,11 @@ Catalogue::~Catalogue() delete i->second; } +float Catalogue::get_rail_elevation() const +{ + return ballast_profile.get_height()+rail_profile.get_height(); +} + void Catalogue::add_track(TrackType &track) { if(tracks.count(track.get_article_number())) @@ -66,15 +71,6 @@ const VehicleType &Catalogue::get_vehicle(unsigned art_nr) const return *i->second; } -const LocoType &Catalogue::get_locomotive(unsigned art_nr) const -{ - const VehicleType &veh = get_vehicle(art_nr); - if(const LocoType *loco = dynamic_cast(&veh)) - return *loco; - - throw Exception("Vehicle is not a locomotive"); -} - Catalogue::Loader::Loader(Catalogue &c): DataFile::BasicLoader(c) @@ -82,7 +78,6 @@ Catalogue::Loader::Loader(Catalogue &c): add("ballast_profile", &Loader::ballast_profile); add("gauge", &Loader::gauge); add("layout", &Loader::layout); - add("locomotive", &Loader::locomotive); add("rail_profile", &Loader::rail_profile); add("scale", &Loader::scale); add("track", &Loader::track); @@ -107,14 +102,6 @@ void Catalogue::Loader::layout() load_sub(obj.layout); } -void Catalogue::Loader::locomotive(unsigned art_nr) -{ - RefPtr loco = new LocoType(art_nr); - load_sub(*loco); - obj.add_vehicle(*loco); - loco.release(); -} - void Catalogue::Loader::rail_profile() { load_sub(obj.rail_profile);