mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 10:30:28 +00:00
(svn r24280) -Cleanup: Remove uselessly duplicated code to set string parameters in company news.
This commit is contained in:
parent
8bce6453d3
commit
806e5f33d4
@ -278,26 +278,10 @@ struct NewsWindow : Window {
|
|||||||
this->flags |= WF_DISABLE_VP_SCROLL;
|
this->flags |= WF_DISABLE_VP_SCROLL;
|
||||||
|
|
||||||
this->CreateNestedTree(desc);
|
this->CreateNestedTree(desc);
|
||||||
switch (this->ni->subtype) {
|
|
||||||
case NS_COMPANY_TROUBLE:
|
|
||||||
this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = STR_NEWS_COMPANY_IN_TROUBLE_TITLE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NS_COMPANY_MERGER:
|
/* For company news with a face we have a separate headline in param[0] */
|
||||||
this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = STR_NEWS_COMPANY_MERGER_TITLE;
|
if (desc == &_company_news_desc) this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = this->ni->params[0];
|
||||||
break;
|
|
||||||
|
|
||||||
case NS_COMPANY_BANKRUPT:
|
|
||||||
this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = STR_NEWS_COMPANY_BANKRUPT_TITLE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case NS_COMPANY_NEW:
|
|
||||||
this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = STR_NEWS_COMPANY_LAUNCH_TITLE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
this->FinishInitNested(desc, 0);
|
this->FinishInitNested(desc, 0);
|
||||||
|
|
||||||
/* Initialize viewport if it exists. */
|
/* Initialize viewport if it exists. */
|
||||||
@ -520,29 +504,9 @@ private:
|
|||||||
|
|
||||||
StringID GetCompanyMessageString() const
|
StringID GetCompanyMessageString() const
|
||||||
{
|
{
|
||||||
switch (this->ni->subtype) {
|
/* Company news with a face have a separate headline, so the normal message is shifted by two params */
|
||||||
case NS_COMPANY_TROUBLE:
|
CopyInDParam(0, this->ni->params + 2, lengthof(this->ni->params) - 2);
|
||||||
SetDParam(0, this->ni->params[2]);
|
return this->ni->params[1];
|
||||||
return STR_NEWS_COMPANY_IN_TROUBLE_DESCRIPTION;
|
|
||||||
|
|
||||||
case NS_COMPANY_MERGER:
|
|
||||||
SetDParam(0, this->ni->params[2]);
|
|
||||||
SetDParam(1, this->ni->params[3]);
|
|
||||||
SetDParam(2, this->ni->params[4]);
|
|
||||||
return this->ni->params[4] == 0 ? STR_NEWS_MERGER_TAKEOVER_TITLE : STR_NEWS_COMPANY_MERGER_DESCRIPTION;
|
|
||||||
|
|
||||||
case NS_COMPANY_BANKRUPT:
|
|
||||||
SetDParam(0, this->ni->params[2]);
|
|
||||||
return STR_NEWS_COMPANY_BANKRUPT_DESCRIPTION;
|
|
||||||
|
|
||||||
case NS_COMPANY_NEW:
|
|
||||||
SetDParam(0, this->ni->params[2]);
|
|
||||||
SetDParam(1, this->ni->params[3]);
|
|
||||||
return STR_NEWS_COMPANY_LAUNCH_DESCRIPTION;
|
|
||||||
|
|
||||||
default:
|
|
||||||
NOT_REACHED();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StringID GetNewVehicleMessageString(int widget) const
|
StringID GetNewVehicleMessageString(int widget) const
|
||||||
|
Loading…
Reference in New Issue
Block a user