]> git.tdb.fi Git - r2c2.git/blobdiff - source/engineer/trainpanel.cpp
Strip Id tags and copyright notices from files
[r2c2.git] / source / engineer / trainpanel.cpp
index 813a53417452b43807650df9035e1b2ad34227b3..3d0b0b874923e495af1fc94676b577268e842422 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of R²C²
-Copyright © 2006-2011  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #include <cmath>
 #include <msp/strings/formatter.h>
 #include "libr2c2/aicontrol.h"
@@ -25,6 +18,7 @@ using namespace R2C2;
 TrainPanel::TrainPanel(Engineer &e, Train &t):
        engineer(e),
        train(t),
+       status(train),
        expanded(false)
 {
        set_size(200, 65);
@@ -77,14 +71,14 @@ TrainPanel::TrainPanel(Engineer &e, Train &t):
        lbl_route->set_geometry(GLtk::Geometry(10, 85, geom.w-20, 20));
        train.signal_route_changed.connect(sigc::mem_fun(this, &TrainPanel::train_route_changed));
 
-       pnl_extra->add(*(lbl_status = new GLtk::Label(train.get_status())));
+       pnl_extra->add(*(lbl_status = new GLtk::Label(status.get_status())));
        lbl_status->set_style("digital");
        lbl_status->set_geometry(GLtk::Geometry(10, 60, geom.w-20, 20));
-       train.signal_status_changed.connect(sigc::mem_fun(this, &TrainPanel::train_status_changed));
+       status.signal_changed.connect(sigc::mem_fun(this, &TrainPanel::train_status_changed));
 
-       const map<unsigned, string> &funcs = train.get_locomotive_type().get_functions();
+       const VehicleType::FunctionMap &funcs = train.get_locomotive_type().get_functions();
        unsigned x = 10;
-       for(map<unsigned, string>::const_iterator i=funcs.begin(); i!=funcs.end(); ++i, x+=36)
+       for(VehicleType::FunctionMap::const_iterator i=funcs.begin(); i!=funcs.end(); ++i, x+=36)
        {
                string fname = i->second;
                fname[0] = toupper(fname[0]);
@@ -157,7 +151,7 @@ void TrainPanel::ai_event(const TrainAI::Message &msg)
                lbl_speed->set_text(format("%3.0f", speed));
        }
        else if(msg.type=="reverse-changed")
-               tgl_forward->set_value(msg.value.value<bool>());
+               tgl_forward->set_value(!msg.value.value<bool>());
 }
 
 void TrainPanel::train_function_changed(unsigned func, bool value)