Changeset - r7484:76081b2ff48c
[Not reviewed]
master
0 9 0
rubidium - 17 years ago 2007-08-28 06:46:33
rubidium@openttd.org
(svn r10995) -Codechange: unify the way to get the displayed maxium speed of a vehicle. Patch by nycom.
9 files changed with 14 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/aircraft.h
Show inline comments
 
@@ -129,6 +129,7 @@ struct Aircraft : public Vehicle {
 
	bool IsPrimaryVehicle() const { return IsNormalAircraft(this); }
 
	int GetImage(Direction direction) const;
 
	int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
 
	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 16; }
 
	void Tick();
 
};
 

	
src/aircraft_gui.cpp
Show inline comments
 
@@ -86,7 +86,7 @@ static void AircraftDetailsWndProc(Windo
 

	
 
		/* Draw max speed */
 
		{
 
			SetDParam(0, v->max_speed * 10 / 16);
 
			SetDParam(0, v->GetDisplayMaxSpeed());
 
			DrawString(2, 25, STR_A00E_MAX_SPEED, 0);
 
		}
 

	
src/roadveh.h
Show inline comments
 
@@ -82,6 +82,7 @@ struct RoadVehicle : public Vehicle {
 
	bool HasFront() const { return true; }
 
	int GetImage(Direction direction) const;
 
	int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; }
 
	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
 
	void Tick();
 
};
 

	
src/roadveh_gui.cpp
Show inline comments
 
@@ -97,7 +97,7 @@ static void RoadVehDetailsWndProc(Window
 

	
 
		/* Draw max speed */
 
		{
 
			SetDParam(0, v->max_speed * 10 / 32);
 
			SetDParam(0, v->GetDisplayMaxSpeed());
 
			DrawString(2, 25, STR_900E_MAX_SPEED, 0);
 
		}
 

	
src/ship.h
Show inline comments
 
@@ -47,6 +47,7 @@ struct Ship: public Vehicle {
 
	bool IsPrimaryVehicle() const { return true; }
 
	int GetImage(Direction direction) const;
 
	int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; }
 
	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
 
	void Tick();
 
};
 

	
src/ship_gui.cpp
Show inline comments
 
@@ -56,7 +56,7 @@ static void ShipDetailsWndProc(Window *w
 

	
 
		/* Draw max speed */
 
		{
 
			SetDParam(0, v->max_speed * 10 / 32);
 
			SetDParam(0, v->GetDisplayMaxSpeed());
 
			DrawString(2, 25, STR_9813_MAX_SPEED, 0);
 
		}
 

	
src/train.h
Show inline comments
 
@@ -273,6 +273,7 @@ struct Train : public Vehicle {
 
	bool HasFront() const { return true; }
 
	int GetImage(Direction direction) const;
 
	int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
 
	int GetDisplayMaxSpeed() const { return this->u.rail.cached_max_speed * 10 / 16; }
 
	void Tick();
 
};
 

	
src/train_gui.cpp
Show inline comments
 
@@ -421,7 +421,7 @@ static void DrawTrainDetailsWindow(Windo
 
	SetDParam(3, GetTrainRunningCost(v) >> 8);
 
	DrawString(x, 15, STR_885D_AGE_RUNNING_COST_YR, 0);
 

	
 
	SetDParam(2, v->u.rail.cached_max_speed * 10 / 16);
 
	SetDParam(2, v->GetDisplayMaxSpeed());
 
	SetDParam(1, v->u.rail.cached_power);
 
	SetDParam(0, v->u.rail.cached_weight);
 
	SetDParam(3, v->u.rail.cached_max_te / 1000);
src/vehicle.h
Show inline comments
 
@@ -421,6 +421,12 @@ struct Vehicle : PoolItem<Vehicle, Vehic
 
	virtual int GetDisplaySpeed() const { return 0; }
 

	
 
	/**
 
	 * Gets the maximum speed in mph that can be sent into SetDParam for string processing.
 
	 * @return the vehicle's maximum speed
 
	 */
 
	virtual int GetDisplayMaxSpeed() const { return 0; }
 

	
 
	/**
 
	 * Calls the tick handler of the vehicle
 
	 */
 
	virtual void Tick() {};
0 comments (0 inline, 0 general)