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

Function loadCurrency

src/OpenLoco/src/Graphics/Gfx.cpp:320–351  ·  view source on GitHub ↗

0x0046E07B

Source from the content-addressed store, hash-verified

318
319 // 0x0046E07B
320 void loadCurrency()
321 {
322 const auto* currencyObject = ObjectManager::get<CurrencyObject>();
323 if (currencyObject == nullptr)
324 {
325 return;
326 }
327
328 const auto loadCurrencySymbol = [](const auto font, const auto imageId, const auto dstImageId, int offsetWidth) {
329 const auto* image = getG1Element(imageId);
330 if (image == nullptr)
331 {
332 return;
333 }
334
335 auto* currencyElement = getG1Element(dstImageId);
336 if (currencyElement == nullptr)
337 {
338 return;
339 }
340
341 Gfx::setCharacterWidth(font, U'£', image->width + offsetWidth);
342 *currencyElement = *image;
343 };
344
345 loadCurrencySymbol(Gfx::Font::small, currencyObject->objectIcon, ImageIds::characters_small_currency_sign, -1);
346 loadCurrencySymbol(Gfx::Font::medium_normal, currencyObject->objectIcon + 1, ImageIds::characters_medium_normal_currency_sign, -1);
347 loadCurrencySymbol(Gfx::Font::medium_bold, currencyObject->objectIcon + 2, ImageIds::characters_medium_bold_currency_sign, -1);
348 loadCurrencySymbol(Gfx::Font::large, currencyObject->objectIcon + 3, ImageIds::characters_large_currency_sign, 1);
349
350 invalidateScreen();
351 }
352
353 // 0x00452457
354 void loadPalette(uint32_t imageIndex, uint8_t modifier)

Callers 8

drawFunction · 0.85
onCloseFunction · 0.85
currencyDropdownFunction · 0.85
importSaveToGameStateFunction · 0.85
sub_4748D4Function · 0.85
startFunction · 0.85
loadPreferredCurrencyFunction · 0.85
loadScenarioProgressFunction · 0.85

Calls 3

getG1ElementFunction · 0.85
setCharacterWidthFunction · 0.85
invalidateScreenFunction · 0.85

Tested by

no test coverage detected