Merge branch 'master' into jgrpp

# Conflicts:
#	src/error.h
#	src/error_gui.cpp
#	src/linkgraph/linkgraph_gui.cpp
#	src/misc_gui.cpp
#	src/newgrf_gui.cpp
#	src/news_gui.cpp
#	src/rail_cmd.cpp
#	src/saveload/gamelog_sl.cpp
#	src/script/api/script_text.cpp
#	src/script/script_instance.cpp
#	src/statusbar_gui.cpp
#	src/strings.cpp
#	src/strings_func.h
#	src/strings_internal.h
#	src/table/settings/gui_settings.ini
#	src/table/settings/linkgraph_settings.ini
#	src/textbuf_gui.h
This commit is contained in:
Jonathan G Rennison
2023-11-09 01:35:31 +00:00
130 changed files with 1460 additions and 1263 deletions

View File

@@ -281,7 +281,7 @@ struct NewsWindow : Window {
this->CreateNestedTree();
/* For company news with a face we have a separate headline in param[0] */
if (desc == &_company_news_desc) this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = this->ni->params[0];
if (desc == &_company_news_desc) this->GetWidget<NWidgetCore>(WID_N_TITLE)->widget_data = this->ni->params[0].data;
NWidgetCore *nwid = this->GetWidget<NWidgetCore>(WID_N_SHOW_GROUP);
if (ni->reftype1 == NR_VEHICLE && nwid != nullptr) {
@@ -367,7 +367,7 @@ struct NewsWindow : Window {
break;
case WID_N_MESSAGE:
CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
CopyInDParam(this->ni->params);
str = this->ni->string_id;
break;
@@ -435,7 +435,7 @@ struct NewsWindow : Window {
break;
case WID_N_MESSAGE:
CopyInDParam(0, this->ni->params, lengthof(this->ni->params));
CopyInDParam(this->ni->params);
DrawStringMultiLine(r.left, r.right, r.top, r.bottom, this->ni->string_id, TC_FROMSTRING, SA_CENTER);
break;
@@ -588,8 +588,8 @@ private:
StringID GetCompanyMessageString() const
{
/* Company news with a face have a separate headline, so the normal message is shifted by two params */
CopyInDParam(0, this->ni->params + 2, lengthof(this->ni->params) - 2);
return this->ni->params[1];
CopyInDParam(span(this->ni->params.data() + 2, this->ni->params.size() - 2));
return this->ni->params[1].data;
}
StringID GetNewVehicleMessageString(int widget) const
@@ -810,7 +810,7 @@ NewsItem::NewsItem(StringID string_id, NewsType type, NewsFlag flags, NewsRefere
{
/* show this news message in colour? */
if (_cur_year >= _settings_client.gui.coloured_news_year) this->flags |= NF_INCOLOUR;
CopyOutDParam(this->params, 0, lengthof(this->params));
CopyOutDParam(this->params, 10);
}
/**
@@ -1010,7 +1010,7 @@ void ChangeVehicleNews(VehicleID from_index, VehicleID to_index)
for (NewsItem *ni = _oldest_news; ni != nullptr; ni = ni->next) {
if (ni->reftype1 == NR_VEHICLE && ni->ref1 == from_index) ni->ref1 = to_index;
if (ni->reftype2 == NR_VEHICLE && ni->ref2 == from_index) ni->ref2 = to_index;
if (ni->flags & NF_VEHICLE_PARAM0 && ni->params[0] == from_index) ni->params[0] = to_index;
if (ni->flags & NF_VEHICLE_PARAM0 && ni->params[0].data == from_index) ni->params[0] = to_index;
}
}
@@ -1111,7 +1111,7 @@ void ShowLastNewsMessage()
*/
static void DrawNewsString(uint left, uint right, int y, TextColour colour, const NewsItem *ni)
{
CopyInDParam(0, ni->params, lengthof(ni->params));
CopyInDParam(ni->params);
/* Get the string, replaces newlines with spaces and remove control codes from the string. */
std::string message = StrMakeValid(GetString(ni->string_id), SVS_REPLACE_TAB_CR_NL_WITH_SPACE);