src/ai/trolly/trolly.cpp
changeset 7010 6f0d9f03180d
parent 6990 136a08baf0ed
child 7317 e61af9d8a2b3
equal deleted inserted replaced
7009:9992ccf17e58 7010:6f0d9f03180d
   615 	FOR_ALL_STATIONS(st) {
   615 	FOR_ALL_STATIONS(st) {
   616 		if (st->owner == _current_player) {
   616 		if (st->owner == _current_player) {
   617 			if (p->ainew.tbt == AI_BUS && (FACIL_BUS_STOP & st->facilities) == FACIL_BUS_STOP) {
   617 			if (p->ainew.tbt == AI_BUS && (FACIL_BUS_STOP & st->facilities) == FACIL_BUS_STOP) {
   618 				if (st->town == town) {
   618 				if (st->town == town) {
   619 					// Check how much cargo there is left in the station
   619 					// Check how much cargo there is left in the station
   620 					if ((st->goods[p->ainew.cargo].waiting_acceptance & 0xFFF) > RoadVehInfo(i)->capacity * AI_STATION_REUSE_MULTIPLER) {
   620 					if ((int)st->goods[p->ainew.cargo].cargo.Count() > RoadVehInfo(i)->capacity * AI_STATION_REUSE_MULTIPLER) {
   621 						if (AiNew_CheckVehicleStation(p, st)) {
   621 						if (AiNew_CheckVehicleStation(p, st)) {
   622 							// We did found a station that was good enough!
   622 							// We did found a station that was good enough!
   623 							new_tile = st->xy;
   623 							new_tile = st->xy;
   624 							direction = GetRoadStopDir(st->xy);
   624 							direction = GetRoadStopDir(st->xy);
   625 							break;
   625 							break;
  1256 		// If both years together are not more than AI_MINIMUM_ROUTE_PROFIT,
  1256 		// If both years together are not more than AI_MINIMUM_ROUTE_PROFIT,
  1257 		//  it is not worth the line I guess...
  1257 		//  it is not worth the line I guess...
  1258 		if (v->profit_last_year + v->profit_this_year < AI_MINIMUM_ROUTE_PROFIT ||
  1258 		if (v->profit_last_year + v->profit_this_year < AI_MINIMUM_ROUTE_PROFIT ||
  1259 				(v->reliability * 100 >> 16) < 40) {
  1259 				(v->reliability * 100 >> 16) < 40) {
  1260 			// There is a possibility that the route is fucked up...
  1260 			// There is a possibility that the route is fucked up...
  1261 			if (v->cargo_days > AI_VEHICLE_LOST_DAYS) {
  1261 			if (v->cargo.DaysInTransit() > AI_VEHICLE_LOST_DAYS) {
  1262 				// The vehicle is lost.. check the route, or else, get the vehicle
  1262 				// The vehicle is lost.. check the route, or else, get the vehicle
  1263 				//  back to a depot
  1263 				//  back to a depot
  1264 				// TODO: make this piece of code
  1264 				// TODO: make this piece of code
  1265 			}
  1265 			}
  1266 
  1266