improve version handling

This commit is contained in:
IntelOrca 2015-06-15 18:01:13 +01:00
parent b206a31cae
commit fef88695a0
4 changed files with 18 additions and 0 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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;
}

View File

@ -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