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

Method create

src/OpenLoco/src/Effects/MoneyEffect.cpp:99–130  ·  view source on GitHub ↗

0x00440A74 company : updatingCompanyId global loc : ax, cx, dx amount : ebx

Source from the content-addressed store, hash-verified

97 // loc : ax, cx, dx
98 // amount : ebx
99 MoneyEffect* MoneyEffect::create(const World::Pos3& loc, const CompanyId company, const currency32_t amount)
100 {
101 if (SceneManager::isTitleMode())
102 {
103 return nullptr;
104 }
105
106 auto* m = static_cast<MoneyEffect*>(EntityManager::createEntityMoney());
107 if (m != nullptr)
108 {
109 m->amount = amount;
110 m->spriteWidth = 64;
111 m->spriteHeightNegative = 20;
112 m->spriteHeightPositive = 30;
113 m->baseType = EntityBaseType::effect;
114 m->var_2E = company;
115 m->setSubType(EffectType::windowCurrency);
116 m->frame = 0;
117 m->numMovements = 0;
118 m->moveTo(loc);
119
120 StringId strFormat = (amount < 0) ? StringIds::format_currency_expense_red_negative : StringIds::format_currency_income_green;
121 char buffer[255] = {};
122 FormatArguments args{};
123 args.push(amount);
124 StringManager::formatString(buffer, strFormat, args);
125
126 m->offsetX = -Gfx::TextRenderer::getStringWidth(Gfx::Font::medium_bold, buffer) / 2;
127 m->wiggle = 0;
128 }
129 return m;
130 }
131
132}

Callers

nothing calls this directly

Calls 7

isTitleModeFunction · 0.85
createEntityMoneyFunction · 0.85
formatStringFunction · 0.85
getStringWidthFunction · 0.85
moveToMethod · 0.80
setSubTypeMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected