From 3e60e64dc914badcd3ead3e6c4a5c3f08204cebe Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 6 May 2013 19:49:24 +0300 Subject: [PATCH] Correct ordering of some functions --- source/libr2c2/layout.cpp | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) 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); -- 2.45.2