ai/default/default.c
changeset 4015 4f67e077e30e
parent 4011 59533bcf68ec
child 4024 6b3809fd45e0
equal deleted inserted replaced
4014:7658e2cc9928 4015:4f67e077e30e
   482 	fr->from = from = GetIndustry(s->from);
   482 	fr->from = from = GetIndustry(s->from);
   483 
   483 
   484 	if (cargo == CT_GOODS || cargo == CT_FOOD) {
   484 	if (cargo == CT_GOODS || cargo == CT_FOOD) {
   485 		Town* to_tow = GetTown(s->to);
   485 		Town* to_tow = GetTown(s->to);
   486 
   486 
   487 		if (to_tow->population < (cargo == CT_FOOD ? 200 : 900)) return; // error
   487 		if (to_tow->population < (cargo == CT_FOOD ? 200U : 900U)) return; // error
   488 		fr->to = to_tow;
   488 		fr->to = to_tow;
   489 		to_xy = to_tow->xy;
   489 		to_xy = to_tow->xy;
   490 	} else {
   490 	} else {
   491 		Industry* to_ind = GetIndustry(s->to);
   491 		Industry* to_ind = GetIndustry(s->to);
   492 
   492 
   565 		fr->distance = DistanceManhattan(i->xy, i2->xy);
   565 		fr->distance = DistanceManhattan(i->xy, i2->xy);
   566 	} else {
   566 	} else {
   567 		// pick a dest town, and see if it's big enough
   567 		// pick a dest town, and see if it's big enough
   568 		Town* t = AiFindRandomTown();
   568 		Town* t = AiFindRandomTown();
   569 
   569 
   570 		if (t == NULL || t->population < (cargo == CT_FOOD ? 200 : 900)) return;
   570 		if (t == NULL || t->population < (cargo == CT_FOOD ? 200U : 900U)) return;
   571 
   571 
   572 		fr->to = t;
   572 		fr->to = t;
   573 		fr->distance = DistanceManhattan(i->xy, t->xy);
   573 		fr->distance = DistanceManhattan(i->xy, t->xy);
   574 	}
   574 	}
   575 }
   575 }