]> git.tdb.fi Git - r2c2.git/commitdiff
Minor adjustments to UI code
authorMikko Rasa <tdb@tdb.fi>
Fri, 3 Apr 2015 16:37:46 +0000 (19:37 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 3 Apr 2015 16:37:46 +0000 (19:37 +0300)
source/engineer/userinterface.cpp
source/engineer/userinterface.h

index 95f064a9ce080181490fc1393258395e2c10db75..aec54ad041331ef79ab44f0ba8090c74b9fa2db3 100644 (file)
@@ -40,7 +40,7 @@ UserInterface::UserInterface(Engineer &e, Graphics::Window &window, Input::Keybo
 UserInterface::~UserInterface()
 {
        while(!dyn_dialogs.empty())
-               delete dyn_dialogs.front();
+               delete *dyn_dialogs.begin();
        delete root_arrangement;
 }
 
@@ -52,19 +52,18 @@ void UserInterface::set_status(const string &text)
 
 void UserInterface::add_dynamic_dialog(DynamicDialog &dd)
 {
-       dyn_dialogs.push_back(&dd);
+       dyn_dialogs.insert(&dd);
 }
 
 void UserInterface::remove_dynamic_dialog(DynamicDialog &dd)
 {
-       dyn_dialogs.erase(remove(dyn_dialogs.begin(), dyn_dialogs.end(), &dd), dyn_dialogs.end());
+       dyn_dialogs.erase(&dd);
 }
 
 void UserInterface::show_train(Train &train)
 {
        TrainDialog *dlg = new TrainDialog(engineer, train);
        root.add(*dlg);
-       dlg->autosize();
 }
 
 void UserInterface::show_zone(Zone &zone)
@@ -99,7 +98,7 @@ void UserInterface::tick()
                status_timeout = Time::TimeStamp();
        }
 
-       for(list<DynamicDialog *>::iterator i=dyn_dialogs.begin(); i!=dyn_dialogs.end(); ++i)
+       for(set<DynamicDialog *>::iterator i=dyn_dialogs.begin(); i!=dyn_dialogs.end(); ++i)
                (*i)->update();
 }
 
index 9dd4d425f5ce08928100df4008190688a187ef00..1df53887622842230bd719e44038633f3d1e3399 100644 (file)
@@ -19,7 +19,7 @@ private:
        Msp::GLtk::Arrangement *root_arrangement;
 
        MainWindow main_wnd;
-       std::list<DynamicDialog *> dyn_dialogs;
+       std::set<DynamicDialog *> dyn_dialogs;
        bool import_active;
 
        Msp::Time::TimeStamp status_timeout;