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

@@ -212,7 +212,7 @@ struct GoalListWindow : public Window {
}
case GC_PROGRESS:
if (s->progress != nullptr) {
if (!s->progress.empty()) {
SetDParamStr(0, s->progress);
StringID str = s->completed ? STR_GOALS_PROGRESS_COMPLETE : STR_GOALS_PROGRESS;
DrawString(r.WithWidth(progress_col_width, !rtl), str, TC_FROMSTRING, SA_RIGHT | SA_FORCE);
@@ -242,7 +242,7 @@ struct GoalListWindow : public Window {
/* Calculate progress column width. */
uint max_width = 0;
for (const Goal *s : Goal::Iterate()) {
if (s->progress != nullptr) {
if (!s->progress.empty()) {
SetDParamStr(0, s->progress);
StringID str = s->completed ? STR_GOALS_PROGRESS_COMPLETE : STR_GOALS_PROGRESS;
uint str_width = GetStringBoundingBox(str).width;
@@ -322,14 +322,14 @@ void ShowGoalsList(CompanyID company)
/** Ask a question about a goal. */
struct GoalQuestionWindow : public Window {
char *question; ///< Question to ask (private copy).
int buttons; ///< Number of valid buttons in #button.
int button[3]; ///< Buttons to display.
TextColour colour; ///< Colour of the question text.
std::string question; ///< Question to ask (private copy).
int buttons; ///< Number of valid buttons in #button.
int button[3]; ///< Buttons to display.
TextColour colour; ///< Colour of the question text.
GoalQuestionWindow(WindowDesc *desc, WindowNumber window_number, TextColour colour, uint32 button_mask, const char *question) : Window(desc), colour(colour)
GoalQuestionWindow(WindowDesc *desc, WindowNumber window_number, TextColour colour, uint32 button_mask, const std::string &question) : Window(desc), colour(colour)
{
this->question = stredup(question);
this->question = question;
/* Figure out which buttons we have to enable. */
int n = 0;
@@ -352,10 +352,6 @@ struct GoalQuestionWindow : public Window {
this->FinishInitNested(window_number);
}
~GoalQuestionWindow()
{
free(this->question);
}
void SetStringParameters(int widget) const override
{
@@ -554,7 +550,7 @@ static WindowDesc _goal_question_list_desc[] = {
* @param button_mask Buttons to display.
* @param question Question to ask.
*/
void ShowGoalQuestion(uint16 id, byte type, uint32 button_mask, const char *question)
void ShowGoalQuestion(uint16 id, byte type, uint32 button_mask, const std::string &question)
{
assert(type < GQT_END);
new GoalQuestionWindow(&_goal_question_list_desc[type], id, type == 3 ? TC_WHITE : TC_BLACK, button_mask, question);