check out an older version. For instance revision 50 has working citycars with destinations.
YOu need to change to routines essentially:
void
stadtauto_t::betrete_feld()
{
#ifdef DESTINATION_CITYCARS
if(target!=koord::invalid && abs_distance(pos_next.gib_2d(),target)<10) {
// delete it ...
time_to_life = 0;
fussgaenger_t *fg = new fussgaenger_t(welt, pos_next);
bool ok = welt->lookup(pos_next)->obj_add(fg) != 0;
for(int i=0; i<(fussgaenger_t::count & 3); i++) {
fg->sync_step(64*24);
}
welt->sync_add( fg );
}
#endif
and
bool
stadtauto_t::hop_check()
{
// V.Meyer: weg_position_t changed to grund_t::get_neighbour()
grund_t *from = welt->lookup(pos_next);
if(from==NULL) {
// nothing to go? => destroy ...
time_to_life = 0;
return false;
}
// find the allowed directions
const weg_t *weg = from->get_weg(road_wt);
if(weg==NULL) {
// nothing to go? => destroy ...
time_to_life = 0;
return false;
}
// traffic light phase check (since this is on next tile, it will always be neccessary!)
const ribi_t::ribi fahrtrichtung90 = ribi_typ(get_pos().get_2d(),pos_next.get_2d());
if(weg->has_sign()) {
const roadsign_t* rs = from->find<roadsign_t>();
const roadsign_besch_t* rs_besch = rs->get_besch();
if(rs_besch->is_traffic_light() && (rs->get_dir()&fahrtrichtung90)==0) {
fahrtrichtung = fahrtrichtung90;
calc_bild();
// wait here
current_speed = 48;
weg_next = 0;
return false;
}
}
// next tile unknow => find next tile
if(pos_next_next==koord3d::invalid) {
// ok, nobody did delete the road in front of us
// so we can check for valid directions
ribi_t::ribi ribi = weg->get_ribi() & (~ribi_t::rueckwaerts(fahrtrichtung90));
// cul de sac: return
if(ribi==0) {
pos_next_next = get_pos();
return ist_weg_frei(from);
}
#ifdef DESTINATION_CITYCARS
static weighted_vector_tpl<grund_t *> liste(4);
liste.clear();
#endif
const uint8 offset = ribi_t::ist_einfach(ribi) ? 0 : simrand(4);
for(uint8 i = 0; i < 4; i++) {
const uint8 r = (i+offset)&3;
if( (ribi&ribi_t::nsow[r])!=0 ) {
grund_t *to;
if(from->get_neighbour(to, road_wt, koord::nsow[r])) {
// check, if this is just a single tile deep after a crossing
weg_t *w=to->get_weg(road_wt);
if(ribi_t::ist_einfach(w->get_ribi()) && (w->get_ribi()&ribi_t::nsow[r])==0 && !ribi_t::ist_einfach(ribi)) {
ribi &= ~ribi_t::nsow[r];
continue;
}
// check, if roadsign forbid next step ...
if(w->has_sign()) {
const roadsign_besch_t* rs_besch = to->find<roadsign_t>()->get_besch();
if(rs_besch->get_min_speed()>besch->get_geschw() || rs_besch->is_private_way()) {
// not allowed to go here
ribi &= ~ribi_t::nsow[r];
continue;
}
}
// ok, now check if we are allowed to go here (i.e. no cars blocking)
pos_next_next = to->get_pos();
if(ist_weg_frei(from)) {
// ok, this direction is fine!
ms_traffic_jam = 0;
if(current_speed<48) {
current_speed = 48;
}
#ifdef DESTINATION_CITYCARS
unsigned long dist=abs_distance( to->gib_pos().gib_2d(), target );
liste.push_back( to, dist*dist );
#else
return true;
#endif
}
else {
pos_next_next = koord3d::invalid;
}
}
else {
// not connected?!? => ribi likely wrong
ribi &= ~ribi_t::nsow[r];
}
}
}
#ifdef DESTINATION_CITYCARS
if(liste.get_count()>0) {
pos_next_next = pos_next = liste.at_weight(simrand(liste.get_sum_weight()))->gib_pos();
return true;
}
#endif
And citycar generate succeds only, if the road in question is empty.