]> git.tdb.fi Git - r2c2.git/commitdiff
Use a typedef for the function map in VehicleType
authorMikko Rasa <tdb@tdb.fi>
Sat, 21 May 2011 20:49:42 +0000 (20:49 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sat, 21 May 2011 20:49:42 +0000 (20:49 +0000)
source/engineer/trainpanel.cpp
source/libr2c2/vehicletype.h
source/remote/trainpanel.cpp

index 51e7a88fe8e820f54b76e03a1a0f94749c170365..10208bfda73aab3fb974facf08d269eef55dd247 100644 (file)
@@ -83,9 +83,9 @@ TrainPanel::TrainPanel(Engineer &e, Train &t):
        lbl_status->set_geometry(GLtk::Geometry(10, 60, geom.w-20, 20));
        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]);
index 33d7d6590dba03fdec299a0e4932a5f1e1528f21..949195dd1091aabf8c4cb9776ab5d3888c527d5f 100644 (file)
@@ -129,11 +129,13 @@ public:
 
        typedef std::vector<Rod> RodArray;
 
+       typedef std::map<unsigned, std::string> FunctionMap;
+
 private:
        ArticleNumber art_nr;
        std::string name;
        bool locomotive;
-       std::map<unsigned, std::string> functions;
+       FunctionMap functions;
        bool swap_direction;
        float length;
        float width;
@@ -150,7 +152,7 @@ public:
        const std::string &get_name() const { return name; }
        bool is_locomotive() const { return locomotive; }
        unsigned get_max_function() const;
-       const std::map<unsigned, std::string> &get_functions() const { return functions; }
+       const FunctionMap &get_functions() const { return functions; }
        bool get_swap_direction() const { return swap_direction; }
        float get_length() const { return length; }
        float get_width() const { return width; }
index e0f2658109b81334092e5567022766312e240d8b..f0d6d14d881debe60061aeb1bc0639f5c8a7374d 100644 (file)
@@ -44,8 +44,8 @@ TrainPanel::TrainPanel(Remote &r, R2C2::Client &c, R2C2::NetTrain &t):
 
        Gtk::HBox *func_box = new Gtk::HBox(false, 5);
        vbox->add(*manage(func_box));
-       const std::map<unsigned, string> &funcs = train.get_loco_type().get_functions();
-       for(std::map<unsigned, string>::const_iterator i=funcs.begin(); i!=funcs.end(); ++i)
+       const R2C2::VehicleType::FunctionMap &funcs = train.get_loco_type().get_functions();
+       for(R2C2::VehicleType::FunctionMap::const_iterator i=funcs.begin(); i!=funcs.end(); ++i)
        {
                Gtk::CheckButton *&chk = chk_funcs[i->first];
                chk = new Gtk::CheckButton(i->second);