diff --git a/Makefile.src.in b/Makefile.src.in index ef2d2bb503..6b0fb94020 100644 --- a/Makefile.src.in +++ b/Makefile.src.in @@ -91,6 +91,7 @@ ISODATE := $(shell echo "$(VERSIONS)" | cut -f 2 -d' ') GITHASH := $(shell echo "$(VERSIONS)" | cut -f 4 -d' ') ISTAG := $(shell echo "$(VERSIONS)" | cut -f 5 -d' ') ISSTABLETAG := $(shell echo "$(VERSIONS)" | cut -f 6 -d' ') +YEAR := $(shell echo "$(VERSIONS)" | cut -f 7 -d' ') # Make sure we have something in VERSION and ISODATE ifeq ($(VERSION),) @@ -272,10 +273,10 @@ endif # Revision files $(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in - $(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g" > $(SRC_DIR)/rev.cpp + $(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g;s@!!YEAR!!@$(YEAR)@g" > $(SRC_DIR)/rev.cpp $(SRC_DIR)/os/windows/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/os/windows/ottdres.rc.in - $(Q)cat $(SRC_DIR)/os/windows/ottdres.rc.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g" > $(SRC_DIR)/os/windows/ottdres.rc + $(Q)cat $(SRC_DIR)/os/windows/ottdres.rc.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g;s@!!YEAR!!@$(YEAR)@g" > $(SRC_DIR)/os/windows/ottdres.rc FORCE: diff --git a/findversion.sh b/findversion.sh index ce1390ab53..28fcc121f7 100755 --- a/findversion.sh +++ b/findversion.sh @@ -67,6 +67,7 @@ if [ -d "$ROOT_DIR/.git" ] || [ -f "$ROOT_DIR/.git" ]; then HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null` SHORTHASH=`echo ${HASH} | cut -c1-10` ISODATE=`LC_ALL=C git show -s --pretty='format:%ci' HEAD | "$AWK" '{ gsub("-", "", $1); print $1 }'` + YEAR=`echo ${ISODATE} | cut -c1-4` BRANCH="`git symbolic-ref -q HEAD 2>/dev/null | sed 's@.*/@@'`" TAG="`git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null | sed 's@\^0$@@'`" @@ -103,10 +104,11 @@ else SHORTHASH="" BRANCH="" ISODATE="" + YEAR="" TAG="" VERSION="" ISTAG="0" ISSTABLETAG="0" fi -echo "$VERSION $ISODATE $MODIFIED $HASH $ISTAG $ISSTABLETAG" +echo "$VERSION $ISODATE $MODIFIED $HASH $ISTAG $ISSTABLETAG $YEAR" diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs index a85a085f29..b70bcdf67c 100755 --- a/projects/determineversion.vbs +++ b/projects/determineversion.vbs @@ -19,7 +19,7 @@ Sub FindReplaceInFile(filename, to_find, replacement) file.Close End Sub -Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, isstabletag, filename) +Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, isstabletag, year, filename) FSO.CopyFile filename & ".in", filename FindReplaceInFile filename, "!!MODIFIED!!", modified FindReplaceInFile filename, "!!ISODATE!!", isodate @@ -28,10 +28,11 @@ Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, isstabletag FindReplaceInFile filename, "!!GITHASH!!", githash FindReplaceInFile filename, "!!ISTAG!!", istag FindReplaceInFile filename, "!!ISSTABLETAG!!", isstabletag + FindReplaceInFile filename, "!!YEAR!!", year End Sub Sub UpdateFiles(version) - Dim modified, isodate, cur_date, githash, istag, isstabletag + Dim modified, isodate, cur_date, githash, istag, isstabletag, year cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date) If InStr(version, Chr(9)) Then @@ -41,26 +42,29 @@ Sub UpdateFiles(version) githash = Mid(modified, InStr(modified, Chr(9)) + 1) istag = Mid(githash, InStr(githash, Chr(9)) + 1) isstabletag = Mid(istag, InStr(istag, Chr(9)) + 1) + year = Mid(isstabletag, InStr(isstabletag, Chr(9)) + 1) ' Remove tails from fields version = Mid(version, 1, InStr(version, Chr(9)) - 1) isodate = Mid(isodate, 1, InStr(isodate, Chr(9)) - 1) modified = Mid(modified, 1, InStr(modified, Chr(9)) - 1) githash = Mid(githash, 1, InStr(githash, Chr(9)) - 1) istag = Mid(istag, 1, InStr(istag, Chr(9)) - 1) + isstabletag = Mid(isstabletag, 1, InStr(isstabletag, Chr(9)) - 1) Else isodate = 0 modified = 1 githash = "" istag = 0 isstabletag = 0 + year = "" End If - UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, "../src/rev.cpp" - UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, "../src/os/windows/ottdres.rc" + UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, year, "../src/rev.cpp" + UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, year, "../src/os/windows/ottdres.rc" End Sub Function DetermineVersion() - Dim WshShell, branch, tag, modified, isodate, oExec, line, hash, shorthash + Dim WshShell, branch, tag, modified, isodate, oExec, line, hash, shorthash, year Set WshShell = CreateObject("WScript.Shell") On Error Resume Next @@ -70,6 +74,7 @@ Function DetermineVersion() branch = "" isodate = "" tag = "" + year = "" ' Set the environment to english WshShell.Environment("PROCESS")("LANG") = "en" @@ -108,6 +113,7 @@ Function DetermineVersion() if Err.Number = 0 Then isodate = Mid(oExec.StdOut.ReadLine(), 1, 10) isodate = Replace(isodate, "-", "") + year = Mid(isodate, 1, 4) End If ' Err.Number = 0 ' Check branch @@ -171,7 +177,7 @@ Function DetermineVersion() isstabletag = 0 End If - DetermineVersion = version & Chr(9) & isodate & Chr(9) & modified & Chr(9) & hash & Chr(9) & istag & Chr(9) & isstabletag + DetermineVersion = version & Chr(9) & isodate & Chr(9) & modified & Chr(9) & hash & Chr(9) & istag & Chr(9) & isstabletag & Chr(9) & year End If End Function diff --git a/src/lang/english.txt b/src/lang/english.txt index 2a4ab1c280..93eaef5901 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 950e402309..ff2fc3a23c 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 af27de4bdf..8116de9035 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 48b29f349d..3f5b126dc1 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 f1e669aa56..7689383710 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 609030676a..0d5ab2bc0c 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 69d6b81f9b..39a64034b9 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 bc0c07030b..0fdfc8c605 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. */