void TrainRouter::save(list<DataFile::Statement> &st) const
{
- if(!tag.empty())
- st.push_back((DataFile::Statement("tag"), tag));
-
st.push_back((DataFile::Statement("priority"), priority));
if(!routes.empty())
bool exit_conflict = (exit==static_cast<unsigned>(other_entry));
// TODO: speed matching with preceding train
- // XXX Should invent a better way to get our counterpart from the other train
- TrainRouter *other_router = dynamic_cast<TrainRouter *>(other_train->get_tagged_ai("router"));
+ TrainRouter *other_router = other_train->get_ai_of_type<TrainRouter>();
int other_prio = (other_router ? other_router->get_priority() : 0);
if(!entry_conflict && !exit_conflict && other_prio<priority)
}
}
- BlockIter iter(&block, train.get_entry_to_block(block));
- iter = iter.next();
- if(iter && !is_on_route(*iter))
- arriving = true;
+ if(!routes.empty())
+ {
+ BlockIter iter(&block, train.get_entry_to_block(block));
+ iter = iter.next();
+ if(iter && !is_on_route(*iter))
+ arriving = true;
+ }
}
const Route *TrainRouter::get_route_for_block(const Block &block) const
{
add("priority", &TrainRouter::priority);
add("route", &Loader::route);
- add("tag", &Loader::tag);
}
void TrainRouter::Loader::route(const string &n)
obj.set_route(&obj.train.get_layout().get_route(n));
}
-void TrainRouter::Loader::tag(const string &t)
-{
- obj.set_tag(t);
-}
-
} // namespace R2C2