]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/layout.cpp
Don't advance the estimated train position outside current blocks
[r2c2.git] / source / 3d / layout.cpp
index 8093081d82c2a1630f99812f04e702a15eed8e91..dcf5544e8dfb8435d793dc7aa98fd300971c9ace 100644 (file)
@@ -6,7 +6,6 @@ Distributed under the GPL
 */
 
 #include <algorithm>
-#include <fstream>
 #include <limits>
 #include <msp/gl/rendermode.h>
 #include <msp/gl/select.h>
@@ -35,7 +34,7 @@ Layout3D::~Layout3D()
 
 void Layout3D::set_quality(unsigned q)
 {
-       quality=q;
+       quality = q;
        for(list<Track3D *>::iterator i=tracks.begin(); i!=tracks.end(); ++i)
                (*i)->set_quality(quality);
 }
@@ -76,26 +75,26 @@ Track3D *Layout3D::pick_track(float x, float y, float size) const
        glLoadIdentity();
 
        double clip[4];
-       clip[0]=1;
-       clip[1]=0;
-       clip[2]=x-size;
-       clip[3]=0;
+       clip[0] = 1;
+       clip[1] = 0;
+       clip[2] = x-size;
+       clip[3] = 0;
        glClipPlane(GL_CLIP_PLANE0, clip);
        glEnable(GL_CLIP_PLANE0);
 
-       clip[0]=-1;
-       clip[2]=-(x+size);
+       clip[0] = -1;
+       clip[2] = -(x+size);
        glClipPlane(GL_CLIP_PLANE1, clip);
        glEnable(GL_CLIP_PLANE1);
 
-       clip[0]=0;
-       clip[1]=1;
-       clip[2]=y-size;
+       clip[0] = 0;
+       clip[1] = 1;
+       clip[2] = y-size;
        glClipPlane(GL_CLIP_PLANE2, clip);
        glEnable(GL_CLIP_PLANE2);
 
-       clip[1]=-1;
-       clip[2]=-(y+size);
+       clip[1] = -1;
+       clip[2] = -(y+size);
        glClipPlane(GL_CLIP_PLANE3, clip);
        glEnable(GL_CLIP_PLANE3);
 
@@ -109,13 +108,13 @@ Track3D *Layout3D::pick_track(float x, float y, float size) const
        glDisable(GL_CLIP_PLANE3);
 
        GL::render_mode(GL::RENDER);
-       Track3D *track=0;
-       unsigned track_depth=numeric_limits<unsigned>::max();
+       Track3D *track = 0;
+       unsigned track_depth = numeric_limits<unsigned>::max();
        for(vector<GL::SelectRecord>::iterator i=select_buf.begin(); i!=select_buf.end(); ++i)
                if(i->min_depth<track_depth)
                {
-                       track=reinterpret_cast<Track3D *>(i->names.back());
-                       track_depth=i->min_depth;
+                       track = reinterpret_cast<Track3D *>(i->names.back());
+                       track_depth = i->min_depth;
                }
 
        return track;