* Draw the details for the given vehicle at the given position * * @param v current vehicle * @param r the Rect to draw within */
| 27 | * @param r the Rect to draw within |
| 28 | */ |
| 29 | void DrawAircraftDetails(const Aircraft *v, const Rect &r) |
| 30 | { |
| 31 | Money feeder_share = 0; |
| 32 | |
| 33 | int y = r.top; |
| 34 | for (const Aircraft *u = v; u != nullptr; u = u->Next()) { |
| 35 | if (u->IsNormalAircraft()) { |
| 36 | DrawString(r.left, r.right, y, GetString(STR_VEHICLE_INFO_BUILT_VALUE, PackEngineNameDParam(u->engine_type, EngineNameContext::VehicleDetails), u->build_year, u->value)); |
| 37 | y += GetCharacterHeight(FS_NORMAL); |
| 38 | |
| 39 | if (u->Next()->cargo_cap != 0) { |
| 40 | DrawString(r.left, r.right, y, GetString(STR_VEHICLE_INFO_CAPACITY_CAPACITY, u->cargo_type, u->cargo_cap, u->Next()->cargo_type, u->Next()->cargo_cap, GetCargoSubtypeText(u))); |
| 41 | } else { |
| 42 | DrawString(r.left, r.right, y, GetString(STR_VEHICLE_INFO_CAPACITY, u->cargo_type, u->cargo_cap, GetCargoSubtypeText(u))); |
| 43 | } |
| 44 | y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal; |
| 45 | } |
| 46 | |
| 47 | if (u->cargo_cap != 0) { |
| 48 | uint cargo_count = u->cargo.StoredCount(); |
| 49 | |
| 50 | if (cargo_count != 0) { |
| 51 | /* Cargo names (fix pluralness) */ |
| 52 | DrawString(r.left, r.right, y, GetString(STR_VEHICLE_DETAILS_CARGO_FROM, u->cargo_type, cargo_count, u->cargo.GetFirstStation())); |
| 53 | y += GetCharacterHeight(FS_NORMAL); |
| 54 | feeder_share += u->cargo.GetFeederShare(); |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | y += WidgetDimensions::scaled.vsep_normal; |
| 60 | DrawString(r.left, r.right, y, GetString(STR_VEHICLE_INFO_FEEDER_CARGO_VALUE, feeder_share)); |
| 61 | } |
| 62 | |
| 63 | |
| 64 | /** |
no test coverage detected