From e0d20a44d248d646a5379a8074f1aaff38bc6b09 Mon Sep 17 00:00:00 2001 From: glx Date: Tue, 5 May 2020 18:36:27 +0200 Subject: Codechange: Use a dynamic copyright year --- src/lang/english.txt | 2 +- src/misc_gui.cpp | 4 +++- src/os/windows/ottdres.rc.in | 2 +- src/rev.cpp.in | 5 +++++ src/rev.h | 1 + src/script/api/game/game_window.hpp.sq | 1 + src/script/api/script_window.hpp | 1 + src/widgets/misc_widget.h | 1 + 8 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lang/english.txt b/src/lang/english.txt index 2a4ab1c28..93eaef590 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -2736,7 +2736,7 @@ STR_LAI_OBJECT_DESCRIPTION_COMPANY_OWNED_LAND :Company-owned l STR_ABOUT_OPENTTD :{WHITE}About OpenTTD STR_ABOUT_ORIGINAL_COPYRIGHT :{BLACK}Original copyright {COPYRIGHT} 1995 Chris Sawyer, All rights reserved STR_ABOUT_VERSION :{BLACK}OpenTTD version {REV} -STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD {COPYRIGHT} 2002-2019 The OpenTTD team +STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD {COPYRIGHT} 2002-{RAW_STRING} The OpenTTD team # Framerate display window STR_FRAMERATE_CAPTION :{WHITE}Frame rate diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 950e40230..ff2fc3a23 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -25,6 +25,7 @@ #include "newgrf_debug.h" #include "zoom_func.h" #include "guitimer_func.h" +#include "rev.h" #include "widgets/misc_widget.h" @@ -399,7 +400,7 @@ static const NWidgetPart _nested_about_widgets[] = { NWidget(WWT_EMPTY, INVALID_COLOUR, WID_A_SCROLLING_TEXT), EndContainer(), NWidget(WWT_LABEL, COLOUR_GREY, WID_A_WEBSITE), SetDataTip(STR_BLACK_RAW_STRING, STR_NULL), - NWidget(WWT_LABEL, COLOUR_GREY), SetDataTip(STR_ABOUT_COPYRIGHT_OPENTTD, STR_NULL), + NWidget(WWT_LABEL, COLOUR_GREY, WID_A_COPYRIGHT), SetDataTip(STR_ABOUT_COPYRIGHT_OPENTTD, STR_NULL), EndContainer(), }; @@ -495,6 +496,7 @@ struct AboutWindow : public Window { void SetStringParameters(int widget) const override { if (widget == WID_A_WEBSITE) SetDParamStr(0, "Website: http://www.openttd.org"); + if (widget == WID_A_COPYRIGHT) SetDParamStr(0, _openttd_revision_year); } void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override diff --git a/src/os/windows/ottdres.rc.in b/src/os/windows/ottdres.rc.in index af27de4bd..8116de903 100644 --- a/src/os/windows/ottdres.rc.in +++ b/src/os/windows/ottdres.rc.in @@ -98,7 +98,7 @@ BEGIN VALUE "FileDescription", "OpenTTD\0" VALUE "FileVersion", "!!VERSION!!\0" VALUE "InternalName", "openttd\0" - VALUE "LegalCopyright", "Copyright \xA9 OpenTTD Developers 2002-2019. All Rights Reserved.\0" + VALUE "LegalCopyright", "Copyright \xA9 OpenTTD Developers 2002-!!YEAR!!. All Rights Reserved.\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "openttd.exe\0" VALUE "PrivateBuild", "\0" diff --git a/src/rev.cpp.in b/src/rev.cpp.in index 48b29f349..3f5b126dc 100644 --- a/src/rev.cpp.in +++ b/src/rev.cpp.in @@ -50,6 +50,11 @@ const char _openttd_build_date[] = __DATE__ " " __TIME__; */ const char _openttd_revision_hash[] = "!!GITHASH!!"; +/** + * The year of this version. + */ +const char _openttd_revision_year[] = "!!YEAR!!"; + /** * Let us know if current build was modified. This detection * works even in the case when revision string is overridden by diff --git a/src/rev.h b/src/rev.h index f1e669aa5..768938371 100644 --- a/src/rev.h +++ b/src/rev.h @@ -13,6 +13,7 @@ extern const char _openttd_revision[]; extern const char _openttd_build_date[]; extern const char _openttd_revision_hash[]; +extern const char _openttd_revision_year[]; extern const byte _openttd_revision_modified; extern const byte _openttd_revision_tagged; extern const uint32 _openttd_newgrf_version; diff --git a/src/script/api/game/game_window.hpp.sq b/src/script/api/game/game_window.hpp.sq index 609030676..0d5ab2bc0 100644 --- a/src/script/api/game/game_window.hpp.sq +++ b/src/script/api/game/game_window.hpp.sq @@ -639,6 +639,7 @@ void SQGSWindow_Register(Squirrel *engine) SQGSWindow.DefSQConst(engine, ScriptWindow::WID_TT_BACKGROUND, "WID_TT_BACKGROUND"); SQGSWindow.DefSQConst(engine, ScriptWindow::WID_A_SCROLLING_TEXT, "WID_A_SCROLLING_TEXT"); SQGSWindow.DefSQConst(engine, ScriptWindow::WID_A_WEBSITE, "WID_A_WEBSITE"); + SQGSWindow.DefSQConst(engine, ScriptWindow::WID_A_COPYRIGHT, "WID_A_COPYRIGHT"); SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_CAPTION, "WID_QS_CAPTION"); SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_TEXT, "WID_QS_TEXT"); SQGSWindow.DefSQConst(engine, ScriptWindow::WID_QS_WARNING, "WID_QS_WARNING"); diff --git a/src/script/api/script_window.hpp b/src/script/api/script_window.hpp index 69d6b81f9..39a64034b 100644 --- a/src/script/api/script_window.hpp +++ b/src/script/api/script_window.hpp @@ -1605,6 +1605,7 @@ public: enum AboutWidgets { WID_A_SCROLLING_TEXT = ::WID_A_SCROLLING_TEXT, ///< The actually scrolling text. WID_A_WEBSITE = ::WID_A_WEBSITE, ///< URL of OpenTTD website. + WID_A_COPYRIGHT = ::WID_A_COPYRIGHT, ///< Copyright string }; /** Widgets of the #QueryStringWindow class. */ diff --git a/src/widgets/misc_widget.h b/src/widgets/misc_widget.h index bc0c07030..0fdfc8c60 100644 --- a/src/widgets/misc_widget.h +++ b/src/widgets/misc_widget.h @@ -24,6 +24,7 @@ enum ToolTipsWidgets { enum AboutWidgets { WID_A_SCROLLING_TEXT, ///< The actually scrolling text. WID_A_WEBSITE, ///< URL of OpenTTD website. + WID_A_COPYRIGHT, ///< Copyright string }; /** Widgets of the #QueryStringWindow class. */ -- cgit v1.2.3-54-g00ecf