]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/tracktype.cpp
Code reformatting: add spaces around assignment operators
[r2c2.git] / source / libmarklin / tracktype.cpp
index 7fc796245ef126dba67253e1ae1ab4ce447e6131..692b5625f1335c59fbc594ae11b1816520916b0d 100644 (file)
@@ -23,24 +23,24 @@ float TrackType::get_total_length() const
 
 float TrackType::get_route_length(int r) const
 {
-       float len=0;
+       float len = 0;
        for(vector<TrackPart>::const_iterator i=parts.begin(); i!=parts.end(); ++i)
                if(r<0 || i->route==static_cast<unsigned>(r))
                {
-                       float l=i->length;
+                       float l = i->length;
                        if(i->radius)
-                               l*=abs(i->radius);
-                       len+=l;
+                               l *= abs(i->radius);
+                       len += l;
                }
        return len;
 }
 
 unsigned TrackType::get_n_routes() const
 {
-       unsigned n=1;
+       unsigned n = 1;
        for(vector<TrackPart>::const_iterator i=parts.begin(); i!=parts.end(); ++i)
                if(i->route>=n)
-                       n=i->route+1;
+                       n = i->route+1;
        return n;
 }
 
@@ -53,29 +53,29 @@ void TrackType::collect_endpoints()
 
        for(vector<Endpoint>::iterator i=endpoints.begin(); i!=endpoints.end();)
        {
-               bool rm=false;
+               bool rm = false;
                for(vector<Endpoint>::iterator j=i+1; j!=endpoints.end();)
                {
-                       float dx=i->pos.x-j->pos.x;
-                       float dy=i->pos.y-j->pos.y;
+                       float dx = i->pos.x-j->pos.x;
+                       float dy = i->pos.y-j->pos.y;
                        if(dx*dx+dy*dy<0.0001)
                        {
-                               float da=i->dir-j->dir;
+                               float da = i->dir-j->dir;
                                if(da<-M_PI)
-                                       da+=M_PI*2;
+                                       da += M_PI*2;
                                if(da>M_PI)
-                                       da-=M_PI*2;
+                                       da -= M_PI*2;
                                if(da<-3.1 || da>3.1)
-                                       rm=true;
-                               i->routes|=j->routes;
-                               j=endpoints.erase(j);
+                                       rm = true;
+                               i->routes |= j->routes;
+                               j = endpoints.erase(j);
                        }
                        else
                                ++j;
                }
 
                if(rm)
-                       i=endpoints.erase(i);
+                       i = endpoints.erase(i);
                else
                        ++i;
        }