ai_new.c
changeset 95 883535ac2790
parent 93 813f01f3e02a
child 110 a22a6b07904b
equal deleted inserted replaced
94:37f4a5aec25d 95:883535ac2790
   232 		Industry *i = DEREF_INDUSTRY(ic);
   232 		Industry *i = DEREF_INDUSTRY(ic);
   233 		Station *st;
   233 		Station *st;
   234 		int count = 0;
   234 		int count = 0;
   235 		int j = 0;
   235 		int j = 0;
   236 		
   236 		
   237 		if (i->town->ratings[_current_player] < 0 && CHANCE16(1,4)) return false;
   237 		if (i->town != NULL && i->town->ratings[_current_player] < 0 && CHANCE16(1,4)) return false;
   238 		
   238 		
   239 		// No limits on delevering stations!
   239 		// No limits on delevering stations!
   240 		//  Or for industry that does not give anything yet
   240 		//  Or for industry that does not give anything yet
   241 		if (i->produced_cargo[0] == 0xFF || i->total_production[0] == 0) return true;
   241 		if (i->produced_cargo[0] == 0xFF || i->total_production[0] == 0) return true;
   242 
   242 
   485 
   485 
   486 	// Also check if we don't have already a lot of busses to this city...
   486 	// Also check if we don't have already a lot of busses to this city...
   487 	FOR_ALL_VEHICLES(v) {
   487 	FOR_ALL_VEHICLES(v) {
   488 		if (v->owner == _current_player) {
   488 		if (v->owner == _current_player) {
   489 			sched = v->schedule_ptr;
   489 			sched = v->schedule_ptr;
   490 			if (sched == NULL) continue;
   490 			while (sched != NULL && (ord=*sched++) != 0) {
   491 			while ((ord=*sched++) != 0) {
       
   492 				if ((ord & OT_MASK) == OT_GOTO_STATION && DEREF_STATION(ord >> 8) == st) {
   491 				if ((ord & OT_MASK) == OT_GOTO_STATION && DEREF_STATION(ord >> 8) == st) {
   493 					// This vehicle has this city in his list
   492 					// This vehicle has this city in his list
   494 					count++;
   493 					count++;
   495 				}
   494 				}
   496 			}
   495 			}