]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/catalogue.cpp
Fix remaining exception class names
[r2c2.git] / source / 3d / catalogue.cpp
index 99148f8fb3c234bfd17a0b2a3452ba9594d6967e..7169c60c3272be579162ec093fdbd1c5672a764e 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of R²C²
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #include <msp/fs/stat.h>
 #include <msp/gl/meshbuilder.h>
 #include <msp/gl/object.h>
@@ -36,9 +29,6 @@ Catalogue3D::Catalogue3D(Catalogue &c):
        for(Catalogue::TrackMap::const_iterator i=trks.begin(); i!=trks.end(); ++i)
                track_added(*i->second);
 
-       ballast_material.set_diffuse(GL::Color(0.25, 0.25, 0.25));
-       rail_material.set_diffuse(GL::Color(0.85, 0.85, 0.85));
-
        build_endpoint_mesh();
 }
 
@@ -52,20 +42,12 @@ Catalogue3D::~Catalogue3D()
 
 const TrackType3D &Catalogue3D::get_track(const TrackType &tt) const
 {
-       map<const TrackType *, TrackType3D *>::const_iterator i = tracks.find(&tt);
-       if(i==tracks.end())
-               throw KeyError("Unknown track type");
-
-       return *i->second;
+       return *get_item(tracks, &tt);
 }
 
 const VehicleType3D &Catalogue3D::get_vehicle(const VehicleType &vt) const
 {
-       map<const VehicleType *, VehicleType3D *>::const_iterator i = vehicles.find(&vt);
-       if(i==vehicles.end())
-               throw KeyError("Unknown vehicle type");
-
-       return *i->second;
+       return *get_item(vehicles, &vt);
 }
 
 void Catalogue3D::track_added(const TrackType &track)
@@ -81,12 +63,12 @@ void Catalogue3D::vehicle_added(const VehicleType &veh)
 void Catalogue3D::build_endpoint_mesh()
 {
        const Profile &ballast_profile = catalogue.get_ballast_profile();
-       const Point &ballast_min = ballast_profile.get_min_coords();
-       const Point &ballast_max = ballast_profile.get_max_coords();
+       const Vector &ballast_min = ballast_profile.get_min_coords();
+       const Vector &ballast_max = ballast_profile.get_max_coords();
 
        const Profile &rail_profile = catalogue.get_rail_profile();
-       const Point &rail_min = rail_profile.get_min_coords();
-       const Point &rail_max = rail_profile.get_max_coords();
+       const Vector &rail_min = rail_profile.get_min_coords();
+       const Vector &rail_max = rail_profile.get_max_coords();
 
        float gauge = catalogue.get_gauge();
 
@@ -112,7 +94,7 @@ FS::Path Catalogue3D::locate_file(const string &name)
        if(FS::exists(path))
                return path;
 
-       throw Exception("Can't locate "+name);
+       throw runtime_error("Can't locate "+name);
 }
 
 template<typename T>