Changeset - r22586:e1be37d1179e
[Not reviewed]
master
0 4 0
alberth - 8 years ago 2017-03-18 20:43:43
alberth@openttd.org
(svn r27797) -Add: Display aircraft type in its vehicle window (patch by Samu)
4 files changed with 31 insertions and 5 deletions:
0 comments (0 inline, 0 general)
src/engine.cpp
Show inline comments
 
@@ -461,13 +461,32 @@ uint16 Engine::GetRange() const
 

	
 
		default: NOT_REACHED();
 
	}
 
}
 

	
 
/**
 
 * Initializes the EngineOverrideManager with the default engines.
 
 * Get the name of the aircraft type for display purposes.
 
 * @return Aircraft type string.
 
 */
 
StringID Engine::GetAircraftTypeText() const
 
{
 
	switch (this->type) {
 
		case VEH_AIRCRAFT:
 
			switch (this->u.air.subtype) {
 
				case AIR_HELI: return STR_LIVERY_HELICOPTER;
 
				case AIR_CTOL: return STR_LIVERY_SMALL_PLANE;
 
				case AIR_CTOL | AIR_FAST: return STR_LIVERY_LARGE_PLANE;
 
				default: NOT_REACHED();
 
			}
 

	
 
		default: NOT_REACHED();
 
	}
 
}
 

	
 
/**
 
 * Initializes the #EngineOverrideManager with the default engines.
 
 */
 
void EngineOverrideManager::ResetToDefaultMapping()
 
{
 
	this->Clear();
 
	for (VehicleType type = VEH_TRAIN; type <= VEH_AIRCRAFT; type++) {
 
		for (uint internal_id = 0; internal_id < _engine_counts[type]; internal_id++) {
src/engine_base.h
Show inline comments
 
@@ -108,12 +108,13 @@ struct Engine : EnginePool::PoolItem<&_e
 
	uint GetDisplayMaxSpeed() const;
 
	uint GetPower() const;
 
	uint GetDisplayWeight() const;
 
	uint GetDisplayMaxTractiveEffort() const;
 
	Date GetLifeLengthInDays() const;
 
	uint16 GetRange() const;
 
	StringID GetAircraftTypeText() const;
 

	
 
	/**
 
	 * Check whether the engine is hidden in the GUI for the given company.
 
	 * @param c Company to check.
 
	 * @return \c true iff the engine is hidden in the GUI for the given company.
 
	 */
src/lang/english.txt
Show inline comments
 
@@ -3654,13 +3654,14 @@ STR_VEHICLE_DETAILS_AIRCRAFT_RENAME     
 
STR_VEHICLE_INFO_AGE_RUNNING_COST_YR                            :{BLACK}Age: {LTBLUE}{STRING2}{BLACK}   Running Cost: {LTBLUE}{CURRENCY_LONG}/yr
 
# The next two need to stay in this order
 
STR_VEHICLE_INFO_AGE                                            :{COMMA} year{P "" s} ({COMMA})
 
STR_VEHICLE_INFO_AGE_RED                                        :{RED}{COMMA} year{P "" s} ({COMMA})
 

	
 
STR_VEHICLE_INFO_MAX_SPEED                                      :{BLACK}Max. speed: {LTBLUE}{VELOCITY}
 
STR_VEHICLE_INFO_MAX_SPEED_RANGE                                :{BLACK}Max. speed: {LTBLUE}{VELOCITY} {BLACK}Range: {LTBLUE}{COMMA} tiles
 
STR_VEHICLE_INFO_MAX_SPEED_TYPE                                 :{BLACK}Max. speed: {LTBLUE}{VELOCITY} {BLACK}Aircraft type: {LTBLUE}{STRING}
 
STR_VEHICLE_INFO_MAX_SPEED_TYPE_RANGE                           :{BLACK}Max. speed: {LTBLUE}{VELOCITY} {BLACK}Aircraft type: {LTBLUE}{STRING} {BLACK}Range: {LTBLUE}{COMMA} tiles
 
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED                         :{BLACK}Weight: {LTBLUE}{WEIGHT_SHORT} {BLACK}Power: {LTBLUE}{POWER}{BLACK} Max. speed: {LTBLUE}{VELOCITY}
 
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE                  :{BLACK}Weight: {LTBLUE}{WEIGHT_SHORT} {BLACK}Power: {LTBLUE}{POWER}{BLACK} Max. speed: {LTBLUE}{VELOCITY} {BLACK}Max. T.E.: {LTBLUE}{FORCE}
 

	
 
STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR                     :{BLACK}Profit this year: {LTBLUE}{CURRENCY_LONG} (last year: {CURRENCY_LONG})
 
STR_VEHICLE_INFO_RELIABILITY_BREAKDOWNS                         :{BLACK}Reliability: {LTBLUE}{COMMA}%  {BLACK}Breakdowns since last service: {LTBLUE}{COMMA}
 

	
src/vehicle_gui.cpp
Show inline comments
 
@@ -2066,15 +2066,20 @@ struct VehicleDetailsWindow : Window {
 
						string = STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED;
 
					} else {
 
						string = STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE;
 
					}
 
				} else {
 
					SetDParam(0, v->GetDisplayMaxSpeed());
 
					if (v->type == VEH_AIRCRAFT && Aircraft::From(v)->GetRange() > 0) {
 
						SetDParam(1, Aircraft::From(v)->GetRange());
 
						string = STR_VEHICLE_INFO_MAX_SPEED_RANGE;
 
					if (v->type == VEH_AIRCRAFT) {
 
						SetDParam(1, v->GetEngine()->GetAircraftTypeText());
 
						if (Aircraft::From(v)->GetRange() > 0) {
 
							SetDParam(2, Aircraft::From(v)->GetRange());
 
							string = STR_VEHICLE_INFO_MAX_SPEED_TYPE_RANGE;
 
						} else {
 
							string = STR_VEHICLE_INFO_MAX_SPEED_TYPE;
 
						}
 
					} else {
 
						string = STR_VEHICLE_INFO_MAX_SPEED;
 
					}
 
				}
 
				DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, string);
 
				y += FONT_HEIGHT_NORMAL;
0 comments (0 inline, 0 general)