Changeset - r19335:74247eaadfef
[Not reviewed]
master
0 5 0
michi_cc - 12 years ago 2012-05-14 19:56:49
michi_cc@openttd.org
(svn r24246) -Add [FS#5052-ish]: [NewGRF] Variable with the current max speed for vehicles.
5 files changed with 14 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/aircraft.h
Show inline comments
 
@@ -76,6 +76,7 @@ struct Aircraft FINAL : public Specializ
 
	int GetDisplaySpeed() const    { return this->cur_speed; }
 
	int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed; }
 
	int GetSpeedOldUnits() const   { return this->vcache.cached_max_speed * 10 / 128; }
 
	int GetCurrentMaxSpeed() const { return this->GetSpeedOldUnits(); }
 
	Money GetRunningCost() const;
 
	bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
 
	bool Tick();
src/newgrf_engine.cpp
Show inline comments
 
@@ -619,6 +619,10 @@ static uint32 VehicleGetVariable(Vehicle
 
		case 0x4B: // Long date of last service
 
			return v->date_of_last_service;
 

	
 
		case 0x4C: // Current maximum speed in NewGRF units
 
			if (!v->IsPrimaryVehicle()) return 0;
 
			return v->GetCurrentMaxSpeed();
 

	
 
		/* Variables which use the parameter */
 
		case 0x60: // Count consist's engine ID occurance
 
			if (v->type != VEH_TRAIN) return v->GetEngine()->grf_prop.local_id == parameter ? 1 : 0;
src/ship.h
Show inline comments
 
@@ -37,6 +37,7 @@ struct Ship FINAL : public SpecializedVe
 
	SpriteID GetImage(Direction direction, EngineImageType image_type) const;
 
	int GetDisplaySpeed() const { return this->cur_speed / 2; }
 
	int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; }
 
	int GetCurrentMaxSpeed() const { return min(this->vcache.cached_max_speed, this->current_order.max_speed * 2); }
 
	Money GetRunningCost() const;
 
	bool IsInDepot() const { return this->state == TRACK_BIT_DEPOT; }
 
	bool Tick();
src/train_cmd.cpp
Show inline comments
 
@@ -369,6 +369,8 @@ int Train::GetCurveSpeedLimit() const
 
 */
 
int Train::GetCurrentMaxSpeed() const
 
{
 
	if (_settings_game.vehicle.train_acceleration_model == AM_ORIGINAL) return min(this->gcache.cached_max_track_speed, this->current_order.max_speed);
 

	
 
	int max_speed = this->tcache.cached_max_curve_speed;
 
	assert(max_speed == this->GetCurveSpeedLimit());
 

	
src/vehicle_base.h
Show inline comments
 
@@ -399,6 +399,12 @@ public:
 
	virtual int GetDisplayMaxSpeed() const { return 0; }
 

	
 
	/**
 
	 * Calculates the maximum speed of the vehicle under its current conditions.
 
	 * @return Current maximum speed in native units.
 
	 */
 
	virtual int GetCurrentMaxSpeed() const { return 0; }
 

	
 
	/**
 
	 * Gets the running cost of a vehicle
 
	 * @return the vehicle's running cost
 
	 */
0 comments (0 inline, 0 general)