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

Method GetWidgetString

src/company_gui.cpp:355–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353 }
354
355 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
356 {
357 switch (widget) {
358 case WID_CF_CAPTION:
359 return GetString(STR_FINANCES_CAPTION, this->window_number, this->window_number);
360
361 case WID_CF_BALANCE_VALUE: {
362 const Company *c = Company::Get(this->window_number);
363 return GetString(STR_FINANCES_BANK_BALANCE, c->money);
364 }
365
366 case WID_CF_LOAN_VALUE: {
367 const Company *c = Company::Get(this->window_number);
368 return GetString(STR_FINANCES_TOTAL_CURRENCY, c->current_loan);
369 }
370
371 case WID_CF_OWN_VALUE: {
372 const Company *c = Company::Get(this->window_number);
373 return GetString(STR_FINANCES_TOTAL_CURRENCY, c->money - c->current_loan);
374 }
375
376 case WID_CF_INTEREST_RATE:
377 return GetString(STR_FINANCES_INTEREST_RATE, _settings_game.difficulty.initial_interest);
378
379 case WID_CF_MAXLOAN_VALUE: {
380 const Company *c = Company::Get(this->window_number);
381 return GetString(STR_FINANCES_MAX_LOAN, c->GetMaxLoan());
382 }
383
384 case WID_CF_INCREASE_LOAN:
385 return GetString(STR_FINANCES_BORROW_BUTTON, LOAN_INTERVAL);
386
387 case WID_CF_REPAY_LOAN:
388 return GetString(STR_FINANCES_REPAY_BUTTON, LOAN_INTERVAL);
389
390 default:
391 return this->Window::GetWidgetString(widget, stringid);
392 }
393 }
394
395 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
396 {

Callers

nothing calls this directly

Calls 2

GetMaxLoanMethod · 0.80
GetStringFunction · 0.70

Tested by

no test coverage detected