#include <msp/core/refptr.h>
#include <msp/datafile/parser.h>
#include "catalogue.h"
-#include "locotype.h"
#include "tracktype.h"
+#include "vehicletype.h"
using namespace std;
using namespace Msp;
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<const LocoType *>(&veh))
- return *loco;
-
- throw Exception("Vehicle is not a locomotive");
-}
-
Catalogue::Loader::Loader(Catalogue &c):
DataFile::BasicLoader<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);
load_sub(obj.layout);
}
-void Catalogue::Loader::locomotive(unsigned art_nr)
-{
- RefPtr<LocoType> loco = new LocoType(art_nr);
- load_sub(*loco);
- obj.add_vehicle(*loco);
- loco.release();
-}
-
void Catalogue::Loader::rail_profile()
{
load_sub(obj.rail_profile);