Skip to main content
Topic: r2060 - P****enger AI don't check other player's stop and failed (Read 3257 times) previous topic - next topic

r2060 - P****enger AI don't check other player's stop and failed

simutrans r2060

spieler_t::find_area_for_hub don't check other player's stop.
So if there is an other player's stop, AI try to make a hab on it, and failed.

Quote
Message: spieler_t::find_area_for_hub():   suggest hub at (50,47)
Message: spieler_t::call_general_tool():   failed for tool 19 at (50,47,-1) because of "Das Feld gehoert

patch for fix this problem.
Code: [Select]
Index: simplay.cc
===================================================================
--- simplay.cc (r2060)
+++ simplay.cc (copy)
@@ -2731,10 +2731,10 @@
  const ding_t* thing = gr->obj_bei(0);
  int test_dist = abs_distance( trypos, basis );
  if (thing == NULL || thing->gib_besitzer() == NULL || thing->gib_besitzer() == this) {
- if(gr->is_halt()  &&  gr->gib_halt()->gib_besitzer()==this  &&  gr->hat_weg(road_wt)) {
- // ok, one halt belongs already to us ... (should not really happen!)
+ if(gr->is_halt()  &&  check_owner( this, gr->gib_halt()->gib_besitzer())  &&  gr->hat_weg(road_wt)) {
+ // ok, one halt belongs already to us ... (should not really happen!) but might be a public stop
  return trypos;
- } else if(test_dist<dist  &&  gr->hat_weg(road_wt)  ) {
+ } else if(test_dist<dist  &&  gr->hat_weg(road_wt)  &&  !gr->is_halt()  ) {
  ribi_t::ribi  ribi = gr->gib_weg_ribi_unmasked(road_wt);
  if(  ribi_t::ist_gerade(ribi)  ||  ribi_t::ist_einfach(ribi)  ) {
  best_pos = trypos;

Re: r2060 - P****enger AI don't check other player's stop and failed

Reply #1
I ****ume fixed, since I worked a lot on that code then.