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:
19
src/goal.cpp
19
src/goal.cpp
@@ -90,8 +90,11 @@ CommandCost CmdCreateGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
g->type = type;
|
||||
g->dst = p2;
|
||||
g->company = company;
|
||||
g->text = stredup(text);
|
||||
g->progress = nullptr;
|
||||
if (StrEmpty(text)) {
|
||||
g->progress.clear();
|
||||
} else {
|
||||
g->progress = text;
|
||||
}
|
||||
g->completed = false;
|
||||
|
||||
if (g->company == INVALID_COMPANY) {
|
||||
@@ -154,8 +157,11 @@ CommandCost CmdSetGoalText(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
Goal *g = Goal::Get(p1);
|
||||
free(g->text);
|
||||
g->text = stredup(text);
|
||||
if (StrEmpty(text)) {
|
||||
g->text.clear();
|
||||
} else {
|
||||
g->text = text;
|
||||
}
|
||||
|
||||
if (g->company == INVALID_COMPANY) {
|
||||
InvalidateWindowClassesData(WC_GOALS_LIST);
|
||||
@@ -183,11 +189,10 @@ CommandCost CmdSetGoalProgress(TileIndex tile, DoCommandFlag flags, uint32 p1, u
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
Goal *g = Goal::Get(p1);
|
||||
free(g->progress);
|
||||
if (StrEmpty(text)) {
|
||||
g->progress = nullptr;
|
||||
g->progress.clear();
|
||||
} else {
|
||||
g->progress = stredup(text);
|
||||
g->progress = text;
|
||||
}
|
||||
|
||||
if (g->company == INVALID_COMPANY) {
|
||||
|
Reference in New Issue
Block a user