X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrain.cpp;h=d78e6276ec14bd98780badaef96ddece39ed2be7;hb=59115614ee941fe801416aca2f8f380065bdc2b7;hp=eb1133a565e2d94ff4c1f2ea91eae290e8f2fae1;hpb=e621dd4120cb253417167b4295e436cee095ccb0;p=r2c2.git diff --git a/source/libr2c2/train.cpp b/source/libr2c2/train.cpp index eb1133a..d78e627 100644 --- a/source/libr2c2/train.cpp +++ b/source/libr2c2/train.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -23,19 +24,6 @@ using namespace std; using namespace Msp; -namespace { - -struct SetFlag -{ - bool &flag; - - SetFlag(bool &f): flag(f) { flag = true; } - ~SetFlag() { flag = false; } -}; - -} - - namespace R2C2 { Train::Train(Layout &l, const VehicleType &t, unsigned a, const string &p): @@ -206,15 +194,6 @@ void Train::remove_ai(TrainAI &ai) ais.erase(i); } -TrainAI *Train::get_tagged_ai(const string &tag) const -{ - for(list::const_iterator i=ais.begin(); i!=ais.end(); ++i) - if((*i)->get_tag()==tag) - return *i; - - return 0; -} - void Train::ai_message(const TrainAI::Message &msg) { for(list::iterator i=ais.begin(); i!=ais.end(); ++i) @@ -267,6 +246,8 @@ void Train::unplace() void Train::stop_at(Block *block) { stop_at_block = block; + if(active && !stop_at_block) + reserve_more(); } bool Train::free_block(Block &block)