]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/manipulator.cpp
Add target type to all lexical_casts
[r2c2.git] / source / designer / manipulator.cpp
index 01633fa908246dacdb95424d129e209d7cd63560..c103314564a69daead55d65c255382681819b3e1 100644 (file)
@@ -1,13 +1,6 @@
-/* $Id$
-
-This file is part of R²C²
-Copyright © 2006-2010  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #include <algorithm>
 #include <cmath>
-#include <msp/strings/formatter.h>
+#include <msp/strings/format.h>
 #include "libr2c2/tracktype.h"
 #include "designer.h"
 #include "manipulator.h"
@@ -653,11 +646,7 @@ vector<Track *> Manipulator::create_straight(const R2C2::Vector &start, float di
                float s = sin(dir);
                for(vector<float>::iterator i=lengths.begin(); i!=lengths.end(); ++i)
                {
-                       map<float, const TrackType *>::iterator j = types_by_length.find(*i);
-                       if(j==types_by_length.end())
-                               throw LogicError("Internal error");
-
-                       Track *track = new Track(designer.get_layout(), *j->second);
+                       Track *track = new Track(designer.get_layout(), *get_item(types_by_length, *i));
                        track->set_position(pos);
                        track->set_rotation(dir);