Re: [patch] Choose signal
Reply #10 –
What do you mean with 'both functions'?
This was a bug. It was caused by the fact, that an EOC isn't a signal, but a roadsign. (I think, a wrong defined pak will mess up the system anyway...). Please update in vehicle/simvehikel.cc the routine waggon_t::ist_befahrbar (I will post a new patch, when I'm at home):
bool
waggon_t::ist_befahrbar(const grund_t *bd) const
{
const schiene_t * sch = dynamic_cast<const schiene_t *> (bd->get_weg(get_waytype()));
// Hajo: diesel and steam engines can use electrifed track as well.
// also allow driving on foreign tracks ...
const bool needs_no_electric = !(cnv!=NULL ? cnv->needs_electrification() : besch->get_engine_type()==vehikel_besch_t::electric);
bool ok = (sch!=0) && (needs_no_electric || sch->is_electrified());
if(!ok || !(target_halt.is_bound() || target_koord != koord3d::invalid) || !cnv->is_waiting()) {
return ok;
}
else {
if( target_koord != koord3d::invalid ) {
if( target_koord != bd->get_pos() ) {
if(sch->has_sign()) {
const roadsign_t* rs = bd->find<roadsign_t>();
if(rs->get_besch()->get_wtyp()==get_waytype() && rs->get_besch()->is_end_choose_signal() ) {
return false;
}
}
}
return sch->can_reserve(cnv->self);
}
else {
// we are searching a stop here:
// ok, we can go where we already are ...
if(bd->get_pos()==get_pos()) {
return true;
}
// we cannot p**** an end of choose area
if(sch->has_sign()) {
const roadsign_t* rs = bd->find<roadsign_t>();
if(rs->get_besch()->get_wtyp()==get_waytype() && rs->get_besch()->is_end_choose_signal() ) {
return false;
}
}
// but we can only use empty blocks ...
// now check, if we could enter here
return sch->can_reserve(cnv->self);
}
}
}
Each train calculates a tile-based route, i.e. a list of tiles on which it will drive to it's target.
In the old implementation, a train in front of a CS searched it's target (but this only worked for halts, not for waypoints) within the next EOC-block. Therefore, a train wainting at a 'wrong' station, couldn't continue and you couldn't build a drive-through-station (this is possible with my implementation).
Thank you. I started with 'it', but it sounds very unfamiliar, since in German trains are "he".