src/ai/default/default.cpp
changeset 6358 e7997742bf02
parent 6353 75b086ef8ef1
child 6367 2f569d554980
equal deleted inserted replaced
6357:a09d43cd3e6c 6358:e7997742bf02
  3265 			if (!(st->facilities & FACIL_AIRPORT)) continue;
  3265 			if (!(st->facilities & FACIL_AIRPORT)) continue;
  3266 
  3266 
  3267 			// Do we own the airport? (Oilrigs aren't owned, though.)
  3267 			// Do we own the airport? (Oilrigs aren't owned, though.)
  3268 			if (st->owner != OWNER_NONE && st->owner != _current_player) continue;
  3268 			if (st->owner != OWNER_NONE && st->owner != _current_player) continue;
  3269 
  3269 
  3270 			AirportFTAClass::Flags flags = GetAirport(st->airport_type)->flags;
  3270 			AirportFTAClass::Flags flags = st->Airport()->flags;
  3271 
  3271 
  3272 			if (!(flags & (p->ai.build_kind == 1 && i == 0 ? AirportFTAClass::HELICOPTERS : AirportFTAClass::AIRPLANES))) {
  3272 			if (!(flags & (p->ai.build_kind == 1 && i == 0 ? AirportFTAClass::HELICOPTERS : AirportFTAClass::AIRPLANES))) {
  3273 				continue;
  3273 				continue;
  3274 			}
  3274 			}
  3275 
  3275 
  3467 	veh = AiChooseAircraftToBuild(p->player_money, p->ai.build_kind != 0 ? 0 : AIR_CTOL);
  3467 	veh = AiChooseAircraftToBuild(p->player_money, p->ai.build_kind != 0 ? 0 : AIR_CTOL);
  3468 	if (veh == INVALID_ENGINE) return;
  3468 	if (veh == INVALID_ENGINE) return;
  3469 
  3469 
  3470 	/* XXX - Have the AI pick the hangar terminal in an airport. Eg get airport-type
  3470 	/* XXX - Have the AI pick the hangar terminal in an airport. Eg get airport-type
  3471 	 * and offset to the FIRST depot because the AI picks the st->xy tile */
  3471 	 * and offset to the FIRST depot because the AI picks the st->xy tile */
  3472 	tile += ToTileIndexDiff(GetAirport(GetStationByTile(tile)->airport_type)->airport_depots[0]);
  3472 	tile += ToTileIndexDiff(GetStationByTile(tile)->Airport()->airport_depots[0]);
  3473 	if (CmdFailed(DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_AIRCRAFT))) return;
  3473 	if (CmdFailed(DoCommand(tile, veh, 0, DC_EXEC, CMD_BUILD_AIRCRAFT))) return;
  3474 	loco_id = _new_vehicle_id;
  3474 	loco_id = _new_vehicle_id;
  3475 
  3475 
  3476 	for (i = 0; p->ai.order_list_blocks[i] != 0xFF; i++) {
  3476 	for (i = 0; p->ai.order_list_blocks[i] != 0xFF; i++) {
  3477 		AiBuildRec *aib = (&p->ai.src) + p->ai.order_list_blocks[i];
  3477 		AiBuildRec *aib = (&p->ai.src) + p->ai.order_list_blocks[i];