# HG changeset patch # User alberth # Date 2017-03-18 20:43:43 # Node ID e1be37d1179e7e238003938fab3c879c974005ac # Parent 7d5ac49c463f8ff7d2a909683f48925aa0bc8534 (svn r27797) -Add: Display aircraft type in its vehicle window (patch by Samu) diff --git a/src/engine.cpp b/src/engine.cpp --- a/src/engine.cpp +++ b/src/engine.cpp @@ -464,7 +464,26 @@ uint16 Engine::GetRange() const } /** - * 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() { diff --git a/src/engine_base.h b/src/engine_base.h --- a/src/engine_base.h +++ b/src/engine_base.h @@ -111,6 +111,7 @@ struct Engine : EnginePool::PoolItem<&_e 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. diff --git a/src/lang/english.txt b/src/lang/english.txt --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3657,7 +3657,8 @@ STR_VEHICLE_INFO_AGE 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} diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2069,9 +2069,14 @@ struct VehicleDetailsWindow : Window { } } 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; }