]> git.tdb.fi Git - r2c2.git/commitdiff
Fix route choices in RouterPanel
authorMikko Rasa <tdb@tdb.fi>
Wed, 20 Nov 2013 12:37:12 +0000 (14:37 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 20 Nov 2013 12:37:12 +0000 (14:37 +0200)
source/engineer/routerpanel.cpp

index 5097edaedf84046fc63765322c4cf8d6c1288a7f..11056ea85f28e578c58bbd20b1b65045b1fa669b 100644 (file)
@@ -14,7 +14,7 @@ using namespace R2C2;
 
 string route_name(const Route *const &route)
 {
-       return route->get_name();
+       return route ? route->get_name() : "(none)";
 }
 
 RouterPanel::RouterPanel(Engineer &e, Train &t):
@@ -36,9 +36,11 @@ RouterPanel::RouterPanel(Engineer &e, Train &t):
 
        dynamic_cast<GLtk::Button *>(get_item(widgets, "btn_goto"))->signal_clicked.connect(sigc::mem_fun(this, &RouterPanel::goto_clicked));
 
+       routes.append(0);
        const set<Route *> &lroutes = train.get_layout().get_all<Route>();
        for(set<Route *>::const_iterator i=lroutes.begin(); i!=lroutes.end(); ++i)
-               routes.append(*i);
+               if(!(*i)->is_temporary())
+                       routes.append(*i);
 
        TrainRouter *router = train.get_ai_of_type<TrainRouter>();
        if(!router)