Changeset - r6027:1fb37bd464b6
[Not reviewed]
master
0 3 0
KUDr - 18 years ago 2007-02-15 22:00:04
kudr@openttd.org
(svn r8750) -Fix (r8747): PLANES defined in wingdi.h caused compilation error under Win32. Changed to AIRPLANES
3 files changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/ai/default/default.cpp
Show inline comments
 
@@ -3260,48 +3260,48 @@ static void AiStateAirportStuff(Player *
 
		// case of oilrig route).
 
		aib = &p->ai.src + i;
 

	
 
		FOR_ALL_STATIONS(st) {
 
			// Is this an airport?
 
			if (!(st->facilities & FACIL_AIRPORT)) continue;
 

	
 
			// Do we own the airport? (Oilrigs aren't owned, though.)
 
			if (st->owner != OWNER_NONE && st->owner != _current_player) continue;
 

	
 
			AirportFTAClass::Flags flags = GetAirport(st->airport_type)->flags;
 

	
 
			if (!(flags & (p->ai.build_kind == 1 && i == 0 ? AirportFTAClass::HELICOPTERS : AirportFTAClass::PLANES))) {
 
			if (!(flags & (p->ai.build_kind == 1 && i == 0 ? AirportFTAClass::HELICOPTERS : AirportFTAClass::AIRPLANES))) {
 
				continue;
 
			}
 

	
 
			// Dismiss airports too far away.
 
			if (DistanceMax(st->airport_tile, aib->spec_tile) > aib->rand_rng)
 
				continue;
 

	
 
			// It's ideal airport, let's take it!
 

	
 
			/* XXX: This part is utterly broken - rule should
 
			 * contain number of the rule appropriate for the
 
			 * airport type (country, town, ...), see
 
			 * _airport_default_block_data (rule is just an index
 
			 * in this array). But the only difference between the
 
			 * currently existing two rules (rule 0 - town and rule
 
			 * 1 - country) is the attr field which is used only
 
			 * when building new airports - and that's irrelevant
 
			 * for us. So using just about any rule will suffice
 
			 * here for now (some of the new airport types would be
 
			 * broken because they will probably need different
 
			 * tileoff values etc), no matter that
 
			 * IsHangarTile() makes no sense. --pasky */
 
			if (!(flags & AirportFTAClass::PLANES)) {
 
			if (!(flags & AirportFTAClass::AIRPLANES)) {
 
				/* Heliports should have maybe own rulesets but
 
				 * OTOH we don't want AI to pick them up when
 
				 * looking for a suitable airport type to build.
 
				 * So any of rules 0 or 1 would do for now. The
 
				 * original rule number was 2 but that's a bug
 
				 * because we have no such rule. */
 
				rule = 1;
 
			} else {
 
				rule = IsHangarTile(st->airport_tile);
 
			}
 

	
 
			aib->cur_building_rule = rule;
src/aircraft_cmd.cpp
Show inline comments
 
@@ -242,25 +242,25 @@ int32 CmdBuildAircraft(TileIndex tile, u
 
	int32 value = EstimateAircraftCost(avi);
 

	
 
	// to just query the cost, it is not neccessary to have a valid tile (automation/AI)
 
	if (flags & DC_QUERY_COST) return value;
 

	
 
	if (!IsHangarTile(tile) || !IsTileOwner(tile, _current_player)) return CMD_ERROR;
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 

	
 
	// Prevent building aircraft types at places which can't handle them
 
	const Station* st = GetStationByTile(tile);
 
	const AirportFTAClass* apc = GetAirport(st->airport_type);
 
	if (!(apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::PLANES : AirportFTAClass::HELICOPTERS))) {
 
	if (!(apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS))) {
 
		return CMD_ERROR;
 
	}
 

	
 
	/* Allocate 2 or 3 vehicle structs, depending on type
 
	 * vl[0] = aircraft, vl[1] = shadow, [vl[2] = rotor] */
 
	if (!AllocateVehicles(vl, avi->subtype & AIR_CTOL ? 2 : 3)) {
 
		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 
	}
 

	
 
	unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Aircraft);
 
	if (unit_num > _patches.max_aircraft)
 
		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 
@@ -1631,25 +1631,25 @@ static void AircraftEventHandler_HeliTak
 
	}
 
}
 

	
 
static void AircraftEventHandler_Flying(Vehicle *v, const AirportFTAClass *apc)
 
{
 
	Station *st;
 
	byte landingtype;
 
	AirportFTA *current;
 
	uint16 tcur_speed, tsubspeed;
 

	
 
	st = GetStation(v->u.air.targetairport);
 
	// runway busy or not allowed to use this airstation, circle
 
	if (apc->flags & (v->subtype == AIR_HELICOPTER ? AirportFTAClass::HELICOPTERS : AirportFTAClass::PLANES) &&
 
	if (apc->flags & (v->subtype == AIR_HELICOPTER ? AirportFTAClass::HELICOPTERS : AirportFTAClass::AIRPLANES) &&
 
			st->airport_tile != 0 &&
 
			(st->owner == OWNER_NONE || st->owner == v->owner)) {
 
		// {32,FLYING,NOTHING_block,37}, {32,LANDING,N,33}, {32,HELILANDING,N,41},
 
		// if it is an airplane, look for LANDING, for helicopter HELILANDING
 
		// it is possible to choose from multiple landing runways, so loop until a free one is found
 
		landingtype = (v->subtype == AIR_HELICOPTER) ? HELILANDING : LANDING;
 
		current = apc->layout[v->u.air.pos].next;
 
		while (current != NULL) {
 
			if (current->heading == landingtype) {
 
				// save speed before, since if AirportHasBlock is false, it resets them to 0
 
				// we don't want that for plane in air
 
				// hack for speed thingie
src/airport.h
Show inline comments
 
@@ -113,27 +113,27 @@ typedef struct AirportMovingData {
 
	int16 x;
 
	int16 y;
 
	byte flag;
 
	DirectionByte direction;
 
} AirportMovingData;
 

	
 
struct AirportFTAbuildup;
 

	
 
// Finite sTate mAchine --> FTA
 
typedef struct AirportFTAClass {
 
	public:
 
		enum Flags {
 
			PLANES      = 0x1,
 
			AIRPLANES   = 0x1,
 
			HELICOPTERS = 0x2,
 
			ALL         = PLANES | HELICOPTERS,
 
			ALL         = AIRPLANES | HELICOPTERS,
 
			SHORT_STRIP = 0x4
 
		};
 

	
 
		AirportFTAClass(
 
			const AirportMovingData *moving_data,
 
			const byte *terminals,
 
			const byte *helipads,
 
			byte entry_point,
 
			Flags flags,
 
			const AirportFTAbuildup *apFA,
 
			const TileIndexDiffC *depots,
 
			byte nof_depots,
0 comments (0 inline, 0 general)