]> git.tdb.fi Git - r2c2.git/blobdiff - source/designer/designer.cpp
Add a missing initializer
[r2c2.git] / source / designer / designer.cpp
index 6ae9c0726c45701a5915adc9f852d9fdc1b75e66..ac870a469f4e01d72f7efedfc34782cf5d666134 100644 (file)
@@ -17,6 +17,7 @@
 #include <msp/time/units.h>
 #include <msp/time/utils.h>
 #include "libr2c2/route.h"
+#include "libr2c2/terrain.h"
 #include "libr2c2/tracktype.h"
 #include "libr2c2/zone.h"
 #include "3d/path.h"
@@ -35,6 +36,7 @@
 #include "selection.h"
 #include "slopetool.h"
 #include "svgexporter.h"
+#include "terraintool.h"
 #include "trackbar.h"
 #include "zonebar.h"
 #include "zoneproperties.h"
@@ -61,6 +63,7 @@ Designer::Designer(int argc, char **argv):
 
        // Setup catalogue and layout
        DataFile::load(catalogue, "tracks.dat");
+       DataFile::load(catalogue, "terrain.dat");
 
        cat_layout_3d = new Layout3D(catalogue.get_layout());
 
@@ -428,6 +431,12 @@ void Designer::key_press(unsigned key)
                svg_export();
        else if(key==Msp::Input::KEY_P)
                object_properties();
+       else if(key==Msp::Input::KEY_TAB)
+       {
+               Object *obj = selection.get_object();
+               if(Terrain *terrain = dynamic_cast<Terrain *>(obj))
+                       use_tool(new TerrainTool(*this, keyboard, mouse, *terrain));
+       }
 }
 
 template<typename T>
@@ -472,7 +481,7 @@ void Designer::button_press(unsigned btn)
 
        if(mode==CATALOGUE)
        {
-               Object *obj;
+               Object *obj = 0;
                if(btn==1)
                        obj = pick_object(pointer);
 
@@ -610,6 +619,7 @@ void Designer::show_route(const Route &route)
                path->set_color(GL::Color(0.5, 0.8, 1.0));
                if(unsigned taddr = (*i)->get_turnout_address())
                        path->set_path(route.get_turnout(taddr));
+               highlight_paths.push_back(path);
        }
 }
 
@@ -623,5 +633,6 @@ void Designer::show_zone(const Zone &zone)
                Track3D &t3d = layout_3d->get_3d(**i);
                Path3D *path = new Path3D(t3d);
                path->set_color(GL::Color(0.8, 1.0, 0.5));
+               highlight_paths.push_back(path);
        }
 }