Merge branch 'master' into jgrpp

# Conflicts:
#	.github/workflows/release-windows.yml
#	src/company_base.h
#	src/company_cmd.cpp
#	src/company_gui.cpp
#	src/console_cmds.cpp
#	src/economy.cpp
#	src/economy_cmd.h
#	src/fios.h
#	src/goal.cpp
#	src/group_gui.cpp
#	src/network/core/config.h
#	src/network/network_admin.cpp
#	src/newgrf_config.cpp
#	src/os/windows/win32.cpp
#	src/saveload/afterload.cpp
#	src/saveload/company_sl.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload_error.hpp
#	src/settings_gui.cpp
#	src/ship_cmd.cpp
#	src/stdafx.h
#	src/story.cpp
#	src/story_base.h
#	src/string.cpp
#	src/table/settings/economy_settings.ini
#	src/tests/CMakeLists.txt
#	src/tests/math_func.cpp
This commit is contained in:
Jonathan G Rennison
2023-05-30 00:49:14 +01:00
156 changed files with 2979 additions and 4098 deletions

View File

@@ -61,7 +61,7 @@ protected:
GUIStoryPageList story_pages; ///< Sorted list of pages.
GUIStoryPageElementList story_page_elements; ///< Sorted list of page elements that belong to the current page.
StoryPageID selected_page_id; ///< Pool index of selected page.
char selected_generic_title[255]; ///< If the selected page doesn't have a custom title, this buffer is used to store a generic page title.
std::string selected_generic_title; ///< If the selected page doesn't have a custom title, this buffer is used to store a generic page title.
StoryPageElementID active_button_id; ///< Which button element the player is currently using
@@ -189,9 +189,9 @@ protected:
{
/* Generate generic title if selected page have no custom title. */
StoryPage *page = this->GetSelPage();
if (page != nullptr && page->title == nullptr) {
if (page != nullptr && page->title.empty()) {
SetDParam(0, GetSelPageNum() + 1);
GetString(selected_generic_title, STR_STORY_BOOK_GENERIC_PAGE_ITEM, lastof(selected_generic_title));
selected_generic_title = GetString(STR_STORY_BOOK_GENERIC_PAGE_ITEM);
}
this->story_page_elements.ForceRebuild();
@@ -256,7 +256,7 @@ protected:
for (const StoryPage *p : this->story_pages) {
bool current_page = p->index == this->selected_page_id;
DropDownListStringItem *item = nullptr;
if (p->title != nullptr) {
if (!p->title.empty()) {
item = new DropDownListCharStringItem(p->title, p->index, current_page);
} else {
/* No custom title => use a generic page title with page number. */
@@ -296,7 +296,7 @@ protected:
/* Title lines */
height += FONT_HEIGHT_NORMAL; // Date always use exactly one line.
SetDParamStr(0, page->title != nullptr ? page->title : this->selected_generic_title);
SetDParamStr(0, !page->title.empty() ? page->title : this->selected_generic_title);
height += GetStringHeight(STR_STORY_BOOK_TITLE, max_width);
return height;
@@ -617,7 +617,7 @@ public:
this->owner = (Owner)this->window_number;
/* Initialize selected vars. */
this->selected_generic_title[0] = '\0';
this->selected_generic_title.clear();
this->selected_page_id = INVALID_STORY_PAGE;
this->active_button_id = INVALID_STORY_PAGE_ELEMENT;
@@ -656,7 +656,7 @@ public:
switch (widget) {
case WID_SB_SEL_PAGE: {
StoryPage *page = this->GetSelPage();
SetDParamStr(0, page != nullptr && page->title != nullptr ? page->title : this->selected_generic_title);
SetDParamStr(0, page != nullptr && !page->title.empty() ? page->title : this->selected_generic_title);
break;
}
case WID_SB_CAPTION:
@@ -714,7 +714,7 @@ public:
y_offset += line_height;
/* Title */
SetDParamStr(0, page->title != nullptr ? page->title : this->selected_generic_title);
SetDParamStr(0, !page->title.empty() ? page->title : this->selected_generic_title);
y_offset = DrawStringMultiLine(0, fr.right, y_offset, fr.bottom, STR_STORY_BOOK_TITLE, TC_BLACK, SA_TOP | SA_HOR_CENTER);
/* Page elements */
@@ -774,7 +774,7 @@ public:
for (size_t i = 0; i < this->story_pages.size(); i++) {
const StoryPage *s = this->story_pages[i];
if (s->title != nullptr) {
if (!s->title.empty()) {
SetDParamStr(0, s->title);
} else {
SetDParamStr(0, this->selected_generic_title);
@@ -878,7 +878,7 @@ public:
/* Was the last page removed? */
if (this->story_pages.size() == 0) {
this->selected_generic_title[0] = '\0';
this->selected_generic_title.clear();
}
/* Verify page selection. */