src/aircraft_cmd.cpp
changeset 6027 ff15b8c7c087
parent 6025 414b34699e87
child 6032 fe6a454ac1ba
equal deleted inserted replaced
6026:775982557e0e 6027:ff15b8c7c087
   249 	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
   249 	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
   250 
   250 
   251 	// Prevent building aircraft types at places which can't handle them
   251 	// Prevent building aircraft types at places which can't handle them
   252 	const Station* st = GetStationByTile(tile);
   252 	const Station* st = GetStationByTile(tile);
   253 	const AirportFTAClass* apc = GetAirport(st->airport_type);
   253 	const AirportFTAClass* apc = GetAirport(st->airport_type);
   254 	if (!(apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::PLANES : AirportFTAClass::HELICOPTERS))) {
   254 	if (!(apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS))) {
   255 		return CMD_ERROR;
   255 		return CMD_ERROR;
   256 	}
   256 	}
   257 
   257 
   258 	/* Allocate 2 or 3 vehicle structs, depending on type
   258 	/* Allocate 2 or 3 vehicle structs, depending on type
   259 	 * vl[0] = aircraft, vl[1] = shadow, [vl[2] = rotor] */
   259 	 * vl[0] = aircraft, vl[1] = shadow, [vl[2] = rotor] */
  1638 	AirportFTA *current;
  1638 	AirportFTA *current;
  1639 	uint16 tcur_speed, tsubspeed;
  1639 	uint16 tcur_speed, tsubspeed;
  1640 
  1640 
  1641 	st = GetStation(v->u.air.targetairport);
  1641 	st = GetStation(v->u.air.targetairport);
  1642 	// runway busy or not allowed to use this airstation, circle
  1642 	// runway busy or not allowed to use this airstation, circle
  1643 	if (apc->flags & (v->subtype == AIR_HELICOPTER ? AirportFTAClass::HELICOPTERS : AirportFTAClass::PLANES) &&
  1643 	if (apc->flags & (v->subtype == AIR_HELICOPTER ? AirportFTAClass::HELICOPTERS : AirportFTAClass::AIRPLANES) &&
  1644 			st->airport_tile != 0 &&
  1644 			st->airport_tile != 0 &&
  1645 			(st->owner == OWNER_NONE || st->owner == v->owner)) {
  1645 			(st->owner == OWNER_NONE || st->owner == v->owner)) {
  1646 		// {32,FLYING,NOTHING_block,37}, {32,LANDING,N,33}, {32,HELILANDING,N,41},
  1646 		// {32,FLYING,NOTHING_block,37}, {32,LANDING,N,33}, {32,HELILANDING,N,41},
  1647 		// if it is an airplane, look for LANDING, for helicopter HELILANDING
  1647 		// if it is an airplane, look for LANDING, for helicopter HELILANDING
  1648 		// it is possible to choose from multiple landing runways, so loop until a free one is found
  1648 		// it is possible to choose from multiple landing runways, so loop until a free one is found