From: Mikko Rasa Date: Mon, 6 May 2013 16:49:24 +0000 (+0300) Subject: Correct ordering of some functions X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=3e60e64dc914badcd3ead3e6c4a5c3f08204cebe;p=r2c2.git Correct ordering of some functions --- diff --git a/source/libr2c2/layout.cpp b/source/libr2c2/layout.cpp index fefa3e9..a4c7309 100644 --- a/source/libr2c2/layout.cpp +++ b/source/libr2c2/layout.cpp @@ -72,6 +72,15 @@ void Layout::add_track(Track &t) } } +Track *Layout::pick_track(const Vector &start, const Vector &ray) +{ + for(set::iterator i=tracks.begin(); i!=tracks.end(); ++i) + if((*i)->collide_ray(start, ray)) + return *i; + + return 0; +} + void Layout::remove_track(Track &t) { if(tracks.erase(&t)) @@ -81,27 +90,6 @@ void Layout::remove_track(Track &t) } } -void Layout::add_signal(Signal &s) -{ - if(signals.insert(&s).second) - signal_signal_added.emit(s); -} - -void Layout::remove_signal(Signal &s) -{ - if(signals.erase(&s)) - signal_signal_removed.emit(s); -} - -Track *Layout::pick_track(const Vector &start, const Vector &ray) -{ - for(set::iterator i=tracks.begin(); i!=tracks.end(); ++i) - if((*i)->collide_ray(start, ray)) - return *i; - - return 0; -} - unsigned Layout::allocate_turnout_id() { set used_ids; @@ -117,6 +105,18 @@ unsigned Layout::allocate_turnout_id() return result; } +void Layout::add_signal(Signal &s) +{ + if(signals.insert(&s).second) + signal_signal_added.emit(s); +} + +void Layout::remove_signal(Signal &s) +{ + if(signals.erase(&s)) + signal_signal_removed.emit(s); +} + void Layout::add_block(Block &b) { blocks.insert(&b);