]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/layout.cpp
Flip turnout path bits so they match the Central Station's idea of states
[r2c2.git] / source / libr2c2 / layout.cpp
index 3e49f19b836fa56351f4b42439e9be6b00e588be..cbe226a684c31ffcf6229fd5d1ead978530ae269 100644 (file)
@@ -53,6 +53,8 @@ Layout::~Layout()
                delete trains.begin()->second;
        while(!routes.empty())
                delete *routes.begin();
+       while(!zones.empty())
+               delete *zones.begin();
        while(!tracks.empty())
                delete *tracks.begin();
        while(!blocks.empty())
@@ -84,7 +86,7 @@ void Layout::remove_track(Track &t)
        }
 }
 
-unsigned Layout::allocate_turnout_id(bool dbl)
+unsigned Layout::allocate_turnout_id()
 {
        set<unsigned> used_ids;
        for(set<Track *>::const_iterator i=tracks.begin(); i!=tracks.end(); ++i)
@@ -92,9 +94,9 @@ unsigned Layout::allocate_turnout_id(bool dbl)
                        used_ids.insert((*i)->get_turnout_id());
 
        unsigned result = next_turnout_id;
-       while(used_ids.count(result) || (dbl && used_ids.count(result+1)))
+       while(used_ids.count(result))
                ++result;
-       next_turnout_id = result+1+dbl;
+       next_turnout_id = result+1;
 
        return result;
 }