X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Flayout.cpp;h=cbe226a684c31ffcf6229fd5d1ead978530ae269;hb=85362cce505281c1d281c959e135c9f8fa12bd5c;hp=3e49f19b836fa56351f4b42439e9be6b00e588be;hpb=7e27b311e33beda1746eb63e0945633f262427f6;p=r2c2.git diff --git a/source/libr2c2/layout.cpp b/source/libr2c2/layout.cpp index 3e49f19..cbe226a 100644 --- a/source/libr2c2/layout.cpp +++ b/source/libr2c2/layout.cpp @@ -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 used_ids; for(set::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; }