Changeset - r12160:b49804528c72
[Not reviewed]
master
0 8 0
rubidium - 15 years ago 2009-06-16 13:52:18
rubidium@openttd.org
(svn r16581) -Codechange: unify the access to Engine::lifelength.
8 files changed with 17 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/ai/api/ai_engine.cpp
Show inline comments
 
@@ -117,7 +117,7 @@
 
	if (!IsValidEngine(engine_id)) return -1;
 
	if (GetVehicleType(engine_id) == AIVehicle::VT_RAIL && IsWagon(engine_id)) return -1;
 

	
 
	return ::Engine::Get(engine_id)->lifelength * DAYS_IN_LEAP_YEAR;
 
	return ::Engine::Get(engine_id)->GetLifeLengthInDays();
 
}
 

	
 
/* static */ Money AIEngine::GetRunningCost(EngineID engine_id)
src/aircraft_cmd.cpp
Show inline comments
 
@@ -334,7 +334,7 @@ CommandCost CmdBuildAircraft(TileIndex t
 

	
 
		v->reliability = e->reliability;
 
		v->reliability_spd_dec = e->reliability_spd_dec;
 
		v->max_age = e->lifelength * DAYS_IN_LEAP_YEAR;
 
		v->max_age = e->GetLifeLengthInDays();
 

	
 
		_new_vehicle_id = v->index;
 

	
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -676,7 +676,7 @@ int DrawVehiclePurchaseInfo(int left, in
 
	if (e->type != VEH_TRAIN || RailVehInfo(engine_number)->railveh_type != RAILVEH_WAGON) {
 
		/* Design date - Life length */
 
		SetDParam(0, ymd.year);
 
		SetDParam(1, e->lifelength);
 
		SetDParam(1, e->GetLifeLengthInDays() / DAYS_IN_LEAP_YEAR);
 
		DrawString(left, right, y, STR_PURCHASE_INFO_DESIGNED_LIFE);
 
		y += FONT_HEIGHT_NORMAL;
 

	
src/engine.cpp
Show inline comments
 
@@ -316,6 +316,16 @@ uint Engine::GetDisplayMaxTractiveEffort
 
}
 

	
 
/**
 
 * Returns the vehicle's life length in days.
 
 * @return the life length
 
 */
 
Date Engine::GetLifeLengthInDays() const
 
{
 
	/* Assume leap years; this gives the player a bit more than the given amount of years, but never less. */
 
	return this->lifelength * DAYS_IN_LEAP_YEAR;
 
}
 

	
 
/**
 
 * Initializes the EngineOverrideManager with the default engines.
 
 */
 
void EngineOverrideManager::ResetToDefaultMapping()
src/engine_base.h
Show inline comments
 
@@ -59,6 +59,7 @@ struct Engine : EnginePool::PoolItem<&_e
 
	uint GetPower() const;
 
	uint GetDisplayWeight() const;
 
	uint GetDisplayMaxTractiveEffort() const;
 
	Date GetLifeLengthInDays() const;
 
};
 

	
 
struct EngineIDMapping {
src/roadveh_cmd.cpp
Show inline comments
 
@@ -230,7 +230,7 @@ CommandCost CmdBuildRoadVeh(TileIndex ti
 

	
 
		v->reliability = e->reliability;
 
		v->reliability_spd_dec = e->reliability_spd_dec;
 
		v->max_age = e->lifelength * DAYS_IN_LEAP_YEAR;
 
		v->max_age = e->GetLifeLengthInDays();
 
		_new_vehicle_id = v->index;
 

	
 
		v->name = NULL;
src/ship_cmd.cpp
Show inline comments
 
@@ -799,7 +799,7 @@ CommandCost CmdBuildShip(TileIndex tile,
 

	
 
		v->reliability = e->reliability;
 
		v->reliability_spd_dec = e->reliability_spd_dec;
 
		v->max_age = e->lifelength * DAYS_IN_LEAP_YEAR;
 
		v->max_age = e->GetLifeLengthInDays();
 
		_new_vehicle_id = v->index;
 

	
 
		v->name = NULL;
src/train_cmd.cpp
Show inline comments
 
@@ -869,7 +869,7 @@ CommandCost CmdBuildRailVehicle(TileInde
 

	
 
		v->reliability = e->reliability;
 
		v->reliability_spd_dec = e->reliability_spd_dec;
 
		v->max_age = e->lifelength * DAYS_IN_LEAP_YEAR;
 
		v->max_age = e->GetLifeLengthInDays();
 

	
 
		v->name = NULL;
 
		v->railtype = rvi->railtype;
0 comments (0 inline, 0 general)