Changeset - r16370:3248b10e72ee
[Not reviewed]
master
0 3 0
terkhen - 14 years ago 2010-11-06 12:50:34
terkhen@openttd.org
(svn r21096) -Fix: Display the real max speed for aircrafts instead of always using the engine value.
3 files changed with 7 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/aircraft.h
Show inline comments
 
@@ -87,14 +87,14 @@ struct Aircraft : public SpecializedVehi
 
	void MarkDirty();
 
	void UpdateDeltaXY(Direction direction);
 
	ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }
 
	bool IsPrimaryVehicle() const                  { return this->IsNormalAircraft(); }
 
	SpriteID GetImage(Direction direction) const;
 
	int GetDisplaySpeed() const    { return this->cur_speed; }
 
	int GetDisplayMaxSpeed() const { return this->max_speed; }
 
	int GetSpeedOldUnits() const   { return this->max_speed * 10 / 128; }
 
	int GetDisplayMaxSpeed() const { return this->acache.cached_max_speed; }
 
	int GetSpeedOldUnits() const   { return this->acache.cached_max_speed * 10 / 128; }
 
	Money GetRunningCost() const;
 
	bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
 
	bool Tick();
 
	void OnNewDay();
 
	uint Crash(bool flooded = false);
 
	TileIndex GetOrderStationLocation(StationID station);
src/aircraft_cmd.cpp
Show inline comments
 
@@ -534,13 +534,14 @@ void UpdateAircraftCache(Aircraft *v)
 
	if (max_speed != 0) {
 
		/* Convert from original units to km-ish/h */
 
		max_speed = (max_speed * 128) / 10;
 

	
 
		v->acache.cached_max_speed = max_speed;
 
	} else {
 
		v->acache.cached_max_speed = 0xFFFF;
 
		/* Use the default max speed of the vehicle. */
 
		v->acache.cached_max_speed = v->max_speed;
 
	}
 
}
 

	
 

	
 
/**
 
 * Special velocities for aircraft
 
@@ -636,13 +637,13 @@ byte GetAircraftFlyingAltitude(const Air
 
			break;
 

	
 
		default: break;
 
	}
 

	
 
	/* Make faster planes fly higher so that they can overtake slower ones */
 
	base_altitude += min(20 * (v->max_speed / 200), 90);
 
	base_altitude += min(20 * (v->acache.cached_max_speed / 200), 90);
 

	
 
	return base_altitude;
 
}
 

	
 
/**
 
 * Find the entry point to an airport depending on direction which
src/vehicle_gui.cpp
Show inline comments
 
@@ -806,12 +806,14 @@ static int CDECL VehicleReliabilitySorte
 
/** Sort vehicles by their max speed */
 
static int CDECL VehicleMaxSpeedSorter(const Vehicle * const *a, const Vehicle * const *b)
 
{
 
	int r = 0;
 
	if ((*a)->type == VEH_TRAIN && (*b)->type == VEH_TRAIN) {
 
		r = Train::From(*a)->tcache.cached_max_speed - Train::From(*b)->tcache.cached_max_speed;
 
	} if ((*a)->type == VEH_AIRCRAFT && (*b)->type == VEH_AIRCRAFT) {
 
		r = Aircraft::From(*a)->acache.cached_max_speed - Aircraft::From(*b)->acache.cached_max_speed;
 
	} else {
 
		r = (*a)->max_speed - (*b)->max_speed;
 
	}
 
	return (r != 0) ? r : VehicleNumberSorter(a, b);
 
}
 

	
0 comments (0 inline, 0 general)