]> git.tdb.fi Git - r2c2.git/commitdiff
Cosmetic tweaks
authorMikko Rasa <tdb@tdb.fi>
Sun, 22 Mar 2015 16:02:25 +0000 (18:02 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 22 Mar 2015 17:30:02 +0000 (19:30 +0200)
source/libr2c2/trackchain.cpp
source/libr2c2/trainrouteplanner.cpp
source/libr2c2/zone.cpp

index c6d615dcec3212ec0f262bb4eb9157b3dc889cb8..e661ed4902d5389deafda6ff6f2e7830c015595f 100644 (file)
@@ -150,7 +150,7 @@ TrackIter TrackChain::iter_for(Track &t, Direction d) const
 TrackIter TrackChain::get_end(unsigned i) const
 {
        if(i>=2)
-               throw invalid_argument("TrackChain::get_end");
+               throw out_of_range("TrackChain::get_end");
 
        if(!ends[0])
                return TrackIter();
index ad97cf79f77c0255f23b9c1be7ed5cf0cfe58e69..7e179f39fa41b4f2c3390e55e4a5e02fbbd3bb55 100644 (file)
@@ -498,9 +498,11 @@ void TrainRoutePlanner::TrainRoutingState::advance(const Time::TimeDelta &dt)
 void TrainRoutePlanner::TrainRoutingState::advance_track(unsigned next_path)
 {
        float distance = occupied_tracks->path_length-offset;
+
        track = track.next(path);
        path = next_path;
        occupied_tracks = new OccupiedTrack(*track, path, occupied_tracks);
+
        advance(distance);
        offset = 0;
 }
index de774431b971605f4298f2dd12b78116061bc70c..e2a5177ba96e0cf97af7eed450189b1ef0349ff5 100644 (file)
@@ -147,16 +147,6 @@ TrackIter Zone::iter_for(Track &track, Direction dir) const
        return TrackIter();
 }
 
-TrackIter Zone::get_end(Direction dir) const
-{
-       if(dir==UNSPECIFIED)
-               return ends[0];
-       if(up_end<0)
-               return TrackIter();
-
-       return ends[up_end^(dir==DOWN)];
-}
-
 TrackIter Zone::next_iter(const TrackIter &iter) const
 {
        TrackIter next_outside;
@@ -174,6 +164,16 @@ TrackIter Zone::next_iter(const TrackIter &iter) const
        return next_outside;
 }
 
+TrackIter Zone::get_end(Direction dir) const
+{
+       if(dir==UNSPECIFIED)
+               return ends[0];
+       if(up_end<0)
+               return TrackIter();
+
+       return ends[up_end^(dir==DOWN)];
+}
+
 void Zone::save(list<DataFile::Statement> &st) const
 {
        st.push_back((DataFile::Statement("group"), group));