News:

SimuTranslator
Make Simutrans speak your language.

r2060 - Passenger AI don't check other player's stop and failed

Started by z9999, October 12, 2008, 06:10:28 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

z9999

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.

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;


prissi