MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / DrawShipDetails

Function DrawShipDetails

src/ship_gui.cpp:62–81  ·  view source on GitHub ↗

* Draw the details for the given vehicle at the given position * * @param v current vehicle * @param r the Rect to draw within */

Source from the content-addressed store, hash-verified

60 * @param r the Rect to draw within
61 */
62void DrawShipDetails(const Vehicle *v, const Rect &r)
63{
64 int y = r.top;
65
66 DrawString(r.left, r.right, y, GetString(STR_VEHICLE_INFO_BUILT_VALUE, PackEngineNameDParam(v->engine_type, EngineNameContext::VehicleDetails), v->build_year, v->value));
67 y += GetCharacterHeight(FS_NORMAL);
68
69 DrawString(r.left, r.right, y, GetString(STR_VEHICLE_INFO_CAPACITY, v->cargo_type, v->cargo_cap, GetCargoSubtypeText(v)));
70 y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
71
72 if (v->cargo.StoredCount() > 0) {
73 DrawString(r.left, r.right, y, GetString(STR_VEHICLE_DETAILS_CARGO_FROM, v->cargo_type, v->cargo.StoredCount(), v->cargo.GetFirstStation()));
74 } else {
75 DrawString(r.left, r.right, y, STR_VEHICLE_DETAILS_CARGO_EMPTY);
76 }
77 y += GetCharacterHeight(FS_NORMAL) + WidgetDimensions::scaled.vsep_normal;
78
79 /* Draw Transfer credits text */
80 DrawString(r.left, r.right, y, GetString(STR_VEHICLE_INFO_FEEDER_CARGO_VALUE, v->cargo.GetFeederShare()));
81}

Callers 1

DrawVehicleDetailsMethod · 0.85

Calls 8

PackEngineNameDParamFunction · 0.85
GetCharacterHeightFunction · 0.85
GetCargoSubtypeTextFunction · 0.85
StoredCountMethod · 0.80
DrawStringFunction · 0.70
GetStringFunction · 0.70
GetFirstStationMethod · 0.45
GetFeederShareMethod · 0.45

Tested by

no test coverage detected