X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fengineer%2Fengineer.cpp;h=fad61693aef66161e1822dc18f7e8a209f7d33af;hb=629ded2c61ef25ec34cc52b03fe69d02e72db50f;hp=e7b047d311b42db72493adfc2d0e290ae95c7343;hpb=9def58c4bbec8788430740a1e9afce64a496231f;p=r2c2.git diff --git a/source/engineer/engineer.cpp b/source/engineer/engineer.cpp index e7b047d..fad6169 100644 --- a/source/engineer/engineer.cpp +++ b/source/engineer/engineer.cpp @@ -1,6 +1,6 @@ /* $Id$ -This file is part of the MSP Märklin suite +This file is part of R²C² Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -12,6 +12,7 @@ Distributed under the GPL #include #include #include +#include #include #include #include @@ -25,8 +26,8 @@ Distributed under the GPL #include #include #include -#include "libmarklin/driver.h" -#include "libmarklin/tracktype.h" +#include "libr2c2/driver.h" +#include "libr2c2/tracktype.h" #include "3d/path.h" #include "3d/track.h" #include "3d/vehicle.h" @@ -37,7 +38,7 @@ Distributed under the GPL #include "trainview.h" using namespace std; -using namespace Marklin; +using namespace R2C2; using namespace Msp; Application::RegApp Engineer::reg; @@ -61,13 +62,13 @@ Engineer::Engineer(int argc, char **argv): window.set_title("Railroad Engineer"); window.signal_close.connect(sigc::bind(sigc::mem_fun(this, &Engineer::exit), 0)); - DataFile::load(ui_res, "marklin.res"); + DataFile::load(ui_res, "r2c2.res"); root = new GLtk::Root(ui_res, window); root->signal_button_press.connect(sigc::mem_fun(this, &Engineer::button_press)); root->signal_pointer_motion.connect(sigc::mem_fun(this, &Engineer::pointer_motion)); root->set_visible(true); - main_panel = new MainPanel(*this, ui_res); + main_panel = new MainPanel(*this); root->add(*main_panel); main_panel->set_position(0, window.get_height()-main_panel->get_geometry().h); main_panel->set_visible(true); @@ -131,7 +132,10 @@ Engineer::~Engineer() layout.get_driver().flush(); if(!options.simulate) - layout.save_trains(options.state_fn); + { + layout.save_dynamic(options.state_fn+".tmp"); + FS::rename(options.state_fn+".tmp", options.state_fn); + } delete overlay; delete root; @@ -233,7 +237,7 @@ void Engineer::tick() GL::PushMatrix push_mat; float rot = picking_track->get_endpoint_direction(picking_entry); - Point pos = picking_track->get_endpoint_position(picking_entry); + Vector pos = picking_track->get_endpoint_position(picking_entry); GL::translate(pos.x, pos.y, pos.z+0.03); GL::rotate(rot*180/M_PI+180, 0, 0, 1); @@ -334,7 +338,7 @@ void Engineer::view_all() float max_y = 0; for(Layout3D::TrackMap::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) { - Point minp, maxp; + Vector minp, maxp; i->second->get_bounds(angle, minp, maxp); min_x = min(min_x, minp.x); max_x = max(max_x, maxp.x); @@ -428,7 +432,7 @@ Track3D *Engineer::pick_track(int x, int y) void Engineer::train_added(Train &train) { - TrainPanel *tpanel = new TrainPanel(*this, ui_res, train); + TrainPanel *tpanel = new TrainPanel(*this, train); root->add(*tpanel); train_panels.push_back(tpanel); rearrange_panels();