mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Use parameterised GetString() for statusbar.
parent
3fda5a8a58
commit
4889e4d7f1
|
@ -84,15 +84,13 @@ struct StatusBarWindow : Window {
|
||||||
Dimension d;
|
Dimension d;
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_S_LEFT:
|
case WID_S_LEFT:
|
||||||
SetDParamMaxValue(0, TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR));
|
d = GetStringBoundingBox(GetString(STR_JUST_DATE_LONG, GetParamMaxValue(TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR).base())));
|
||||||
d = GetStringBoundingBox(STR_JUST_DATE_LONG);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_S_RIGHT: {
|
case WID_S_RIGHT: {
|
||||||
int64_t max_money = UINT32_MAX;
|
int64_t max_money = UINT32_MAX;
|
||||||
for (const Company *c : Company::Iterate()) max_money = std::max<int64_t>(c->money, max_money);
|
for (const Company *c : Company::Iterate()) max_money = std::max<int64_t>(c->money, max_money);
|
||||||
SetDParam(0, 100LL * max_money);
|
d = GetStringBoundingBox(GetString(STR_JUST_CURRENCY_LONG, 100LL * max_money));
|
||||||
d = GetStringBoundingBox(STR_JUST_CURRENCY_LONG);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,8 +110,7 @@ struct StatusBarWindow : Window {
|
||||||
switch (widget) {
|
switch (widget) {
|
||||||
case WID_S_LEFT:
|
case WID_S_LEFT:
|
||||||
/* Draw the date */
|
/* Draw the date */
|
||||||
SetDParam(0, TimerGameCalendar::date);
|
DrawString(tr, GetString(STR_JUST_DATE_LONG, TimerGameCalendar::date), TC_WHITE, SA_HOR_CENTER);
|
||||||
DrawString(tr, STR_JUST_DATE_LONG, TC_WHITE, SA_HOR_CENTER);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_S_RIGHT: {
|
case WID_S_RIGHT: {
|
||||||
|
@ -125,8 +122,7 @@ struct StatusBarWindow : Window {
|
||||||
/* Draw company money, if any */
|
/* Draw company money, if any */
|
||||||
const Company *c = Company::GetIfValid(_local_company);
|
const Company *c = Company::GetIfValid(_local_company);
|
||||||
if (c != nullptr) {
|
if (c != nullptr) {
|
||||||
SetDParam(0, c->money);
|
DrawString(tr, GetString(STR_JUST_CURRENCY_LONG, c->money), TC_WHITE, SA_HOR_CENTER);
|
||||||
DrawString(tr, STR_JUST_CURRENCY_LONG, TC_WHITE, SA_HOR_CENTER);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -147,15 +143,13 @@ struct StatusBarWindow : Window {
|
||||||
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED);
|
InvalidateWindowData(WC_STATUS_BAR, 0, SBI_NEWS_DELETED);
|
||||||
if (Company::IsValidID(_local_company)) {
|
if (Company::IsValidID(_local_company)) {
|
||||||
/* This is the default text */
|
/* This is the default text */
|
||||||
SetDParam(0, _local_company);
|
DrawString(tr, GetString(STR_STATUSBAR_COMPANY_NAME, _local_company), TC_FROMSTRING, SA_HOR_CENTER);
|
||||||
DrawString(tr, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Company::IsValidID(_local_company)) {
|
if (Company::IsValidID(_local_company)) {
|
||||||
/* This is the default text */
|
/* This is the default text */
|
||||||
SetDParam(0, _local_company);
|
DrawString(tr, GetString(STR_STATUSBAR_COMPANY_NAME, _local_company), TC_FROMSTRING, SA_HOR_CENTER);
|
||||||
DrawString(tr, STR_STATUSBAR_COMPANY_NAME, TC_FROMSTRING, SA_HOR_CENTER);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue