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

Method getRequiredCargoString

src/OpenLoco/src/Objects/IndustryObject.cpp:67–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65 }
66
67 char* IndustryObject::getRequiredCargoString(const char* buffer) const
68 {
69 char* ptr = (char*)buffer;
70 auto requiredCargoCount = 0;
71
72 for (const auto& requiredCargo : requiredCargoType)
73 {
74 if (requiredCargo != kCargoTypeNull)
75 {
76 requiredCargoCount++;
77
78 if (requiredCargoCount > 1)
79 {
80 if (hasFlags(IndustryObjectFlags::requiresAllCargo))
81 {
82 ptr = StringManager::formatString(ptr, StringIds::cargo_and);
83 }
84 else
85 {
86 ptr = StringManager::formatString(ptr, StringIds::cargo_or);
87 }
88 }
89
90 auto cargoObj = ObjectManager::get<CargoObject>(requiredCargo);
91 ptr = StringManager::formatString(ptr, cargoObj->name);
92 }
93 }
94 return ptr;
95 }
96
97 // 0x0045932D
98 void IndustryObject::drawPreviewImage(Gfx::DrawingContext& drawingCtx, const int16_t x, const int16_t y) const

Callers 3

getStatusStringMethod · 0.80
formatIndustryStringFunction · 0.80
onScrollMouseOverFunction · 0.80

Calls 2

formatStringFunction · 0.85
hasFlagsFunction · 0.50

Tested by

no test coverage detected