]> git.tdb.fi Git - r2c2.git/commitdiff
Don't reserve blocks when not active
authorMikko Rasa <tdb@tdb.fi>
Fri, 23 Apr 2010 19:29:58 +0000 (19:29 +0000)
committerMikko Rasa <tdb@tdb.fi>
Fri, 23 Apr 2010 19:29:58 +0000 (19:29 +0000)
source/libmarklin/train.cpp

index 634f45c11a692a6ecbbd94f06b77051b6e5de7d2..9f97c33182160b9053573cf0fa40115660189199 100644 (file)
@@ -169,8 +169,7 @@ void Train::set_route(const Route *r)
                }
        }
 
-       if(active)
-               reserve_more();
+       reserve_more();
 
        signal_route_changed.emit(route);
 }
@@ -630,6 +629,9 @@ void Train::block_reserved(const Block &block, const Train *train)
 
 unsigned Train::reserve_more()
 {
+       if(!active)
+               return;
+
        BlockRef *last = 0;
        if(!rsv_blocks.empty())
                last = &rsv_blocks.back();