diff --git a/src/rct2.h b/src/rct2.h index 1efc40b2c8..5a651c398c 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -79,6 +79,12 @@ typedef utf16* utf16string; #define OPENRCT2_PLATFORM "Windows" #define OPENRCT2_TIMESTAMP __DATE__ " " __TIME__ +// The following constants are for automated build servers +#define OPENRCT2_BUILD_SERVER "" +#define OPENRCT2_BRANCH "" +#define OPENRCT2_COMMIT_SHA1 "" +#define OPENRCT2_COMMIT_SHA1_SHORT "" + // Represent fixed point numbers. dp = decimal point typedef sint16 fixed16_1dp; typedef sint16 fixed16_2dp; diff --git a/src/title.c b/src/title.c index 4f710188a1..4b0f9636a9 100644 --- a/src/title.c +++ b/src/title.c @@ -374,6 +374,12 @@ static void DrawOpenRCT2(int x, int y) // Format text (name and version) sprintf(buffer, "%c%c%c%s, v%s", FORMAT_MEDIUMFONT, FORMAT_OUTLINE, FORMAT_WHITE, OPENRCT2_NAME, OPENRCT2_VERSION); + if (!str_is_null_or_empty(OPENRCT2_BRANCH)) + sprintf(strchr(buffer, 0), "-%s", OPENRCT2_BRANCH); + if (!str_is_null_or_empty(OPENRCT2_COMMIT_SHA1_SHORT)) + sprintf(strchr(buffer, 0), " (%s)", OPENRCT2_COMMIT_SHA1_SHORT); + if (!str_is_null_or_empty(OPENRCT2_BUILD_SERVER)) + sprintf(strchr(buffer, 0), " provided by %s", OPENRCT2_BUILD_SERVER); // Draw Text gfx_draw_string(dpi, buffer, 0, x + 5, y + 5); diff --git a/src/util/util.c b/src/util/util.c index 8194f87cba..d6e12c0723 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -158,4 +158,9 @@ int strcicmp(char const *a, char const *b) bool utf8_is_bom(const char *str) { return str[0] == 0xEF && str[1] == 0xBB && str[2] == 0xBF; +} + +bool str_is_null_or_empty(const char *str) +{ + return str == NULL || str[0] == 0; } \ No newline at end of file diff --git a/src/util/util.h b/src/util/util.h index 1e776d0b23..0b3a36c6c2 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -39,5 +39,6 @@ bool strequals(const char *a, const char *b, int length, bool caseInsensitive); int strcicmp(char const *a, char const *b); bool utf8_is_bom(const char *str); +bool str_is_null_or_empty(const char *str); #endif