MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / drawDescription

Method drawDescription

src/OpenLoco/src/Objects/VehicleObject.cpp:36–76  ·  view source on GitHub ↗

0x004B8C9D

Source from the content-addressed store, hash-verified

34
35 // 0x004B8C9D
36 void VehicleObject::drawDescription(Gfx::DrawingContext& drawingCtx, const int16_t x, const int16_t y, const int16_t width) const
37 {
38 auto tr = Gfx::TextRenderer(drawingCtx);
39
40 Ui::Point rowPosition = { x, y };
41 ObjectManager::drawGenericDescription(drawingCtx, rowPosition, designed, obsolete);
42 if (power != 0 && (mode == TransportMode::road || mode == TransportMode::rail))
43 {
44 FormatArguments args{};
45 args.push(power);
46 tr.drawStringLeft(rowPosition, Colour::black, StringIds::object_selection_power, args);
47 rowPosition.y += kDescriptionRowHeight;
48 }
49 {
50 FormatArguments args{};
51 args.push<uint32_t>(StringManager::internalLengthToComma1DP(getLength()));
52 tr.drawStringLeft(rowPosition, Colour::black, StringIds::object_selection_length, args);
53 rowPosition.y += kDescriptionRowHeight;
54 }
55 {
56 FormatArguments args{};
57 args.push(weight);
58 tr.drawStringLeft(rowPosition, Colour::black, StringIds::object_selection_weight, args);
59 rowPosition.y += kDescriptionRowHeight;
60 }
61 {
62 FormatArguments args{};
63 args.push(speed);
64 tr.drawStringLeft(rowPosition, Colour::black, StringIds::object_selection_max_speed, args);
65 }
66 auto buffer = const_cast<char*>(StringManager::getString(StringIds::buffer_1250));
67 // Clear buffer
68 *buffer = '\0';
69
70 getCargoString(buffer);
71
72 if (StringManager::locoStrlen(buffer) != 0)
73 {
74 tr.drawStringLeftWrapped(rowPosition, width - 4, Colour::black, StringIds::buffer_1250);
75 }
76 }
77
78 void VehicleObject::getCargoString(char* buffer) const
79 {

Callers

nothing calls this directly

Calls 8

TextRendererClass · 0.85
drawGenericDescriptionFunction · 0.85
internalLengthToComma1DPFunction · 0.85
getStringFunction · 0.85
locoStrlenFunction · 0.85
drawStringLeftMethod · 0.80
drawStringLeftWrappedMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected