src/ai/default/default.cpp
branchcpp_gui
changeset 6303 84c215fc8eb8
parent 6298 c30fe89622df
child 6307 f40e88cff863
equal deleted inserted replaced
6302:bd80897189ba 6303:84c215fc8eb8
   458 	return GetRandomTown();
   458 	return GetRandomTown();
   459 }
   459 }
   460 
   460 
   461 static Industry *AiFindRandomIndustry()
   461 static Industry *AiFindRandomIndustry()
   462 {
   462 {
   463 	return GetRandomIndustry();
   463 	int num = RandomRange(GetMaxIndustryIndex());
       
   464 	if (IsValidIndustry(GetIndustry(num))) return GetIndustry(num);
       
   465 
       
   466 	return NULL;
   464 }
   467 }
   465 
   468 
   466 static void AiFindSubsidyIndustryRoute(FoundRoute *fr)
   469 static void AiFindSubsidyIndustryRoute(FoundRoute *fr)
   467 {
   470 {
   468 	uint i;
   471 	uint i;
  2456 	for (i = 0; p->ai.order_list_blocks[i] != 0xFF; i++) {
  2459 	for (i = 0; p->ai.order_list_blocks[i] != 0xFF; i++) {
  2457 		const AiBuildRec* aib = &p->ai.src + p->ai.order_list_blocks[i];
  2460 		const AiBuildRec* aib = &p->ai.src + p->ai.order_list_blocks[i];
  2458 		bool is_pass = (
  2461 		bool is_pass = (
  2459 			p->ai.cargo_type == CT_PASSENGERS ||
  2462 			p->ai.cargo_type == CT_PASSENGERS ||
  2460 			p->ai.cargo_type == CT_MAIL ||
  2463 			p->ai.cargo_type == CT_MAIL ||
  2461 			(_opt.landscape == LT_NORMAL && p->ai.cargo_type == CT_VALUABLES)
  2464 			(_opt.landscape == LT_TEMPERATE && p->ai.cargo_type == CT_VALUABLES)
  2462 		);
  2465 		);
  2463 		Order order;
  2466 		Order order;
  2464 
  2467 
  2465 		order.type = OT_GOTO_STATION;
  2468 		order.type = OT_GOTO_STATION;
  2466 		order.flags = 0;
  2469 		order.flags = 0;
  3198 	for (i = 0; p->ai.order_list_blocks[i] != 0xFF; i++) {
  3201 	for (i = 0; p->ai.order_list_blocks[i] != 0xFF; i++) {
  3199 		const AiBuildRec* aib = &p->ai.src + p->ai.order_list_blocks[i];
  3202 		const AiBuildRec* aib = &p->ai.src + p->ai.order_list_blocks[i];
  3200 		bool is_pass = (
  3203 		bool is_pass = (
  3201 			p->ai.cargo_type == CT_PASSENGERS ||
  3204 			p->ai.cargo_type == CT_PASSENGERS ||
  3202 			p->ai.cargo_type == CT_MAIL ||
  3205 			p->ai.cargo_type == CT_MAIL ||
  3203 			(_opt.landscape == LT_NORMAL && p->ai.cargo_type == CT_VALUABLES)
  3206 			(_opt.landscape == LT_TEMPERATE && p->ai.cargo_type == CT_VALUABLES)
  3204 		);
  3207 		);
  3205 		Order order;
  3208 		Order order;
  3206 
  3209 
  3207 		order.type = OT_GOTO_STATION;
  3210 		order.type = OT_GOTO_STATION;
  3208 		order.flags = 0;
  3211 		order.flags = 0;