From 65f25f8340fd67f85cb2de496b76932adcb20a94 Mon Sep 17 00:00:00 2001 From: Alexander Overvoorde Date: Wed, 10 Feb 2016 22:43:17 +0100 Subject: [PATCH] Get fallback player name from language files --- src/localisation/string_ids.h | 1 + src/platform/posix.c | 3 ++- src/platform/windows.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/localisation/string_ids.h b/src/localisation/string_ids.h index 893142ad15..9cce3826d0 100644 --- a/src/localisation/string_ids.h +++ b/src/localisation/string_ids.h @@ -475,6 +475,7 @@ enum { STR_WATER_RIDES_TIP = 1227, STR_SHOPS_STALLS_TIP = 1228, + STR_PLAYER_DEFAULT_NAME = 1315, STR_X_PLAYER = 1317, STR_X_PLAYERS = 1318, diff --git a/src/platform/posix.c b/src/platform/posix.c index dea5a78f4c..d683164229 100644 --- a/src/platform/posix.c +++ b/src/platform/posix.c @@ -33,6 +33,7 @@ #include "../addresses.h" #include "../config.h" #include "../localisation/language.h" +#include "../localisation/string_ids.h" #include "../openrct2.h" #include "../util/util.h" #include "platform.h" @@ -882,7 +883,7 @@ utf8* platform_get_username() { if (pw) { return pw->pw_name; } else { - return "Player"; + return language_get_string(STR_PLAYER_DEFAULT_NAME); } } diff --git a/src/platform/windows.c b/src/platform/windows.c index a43920d060..f27e2b563c 100644 --- a/src/platform/windows.c +++ b/src/platform/windows.c @@ -31,6 +31,7 @@ #include "../addresses.h" #include "../openrct2.h" #include "../localisation/language.h" +#include "../localisation/string_ids.h" #include "../util/util.h" #include "../config.h" #include "platform.h" @@ -981,7 +982,7 @@ utf8* platform_get_username() { DWORD usernameLength = UNLEN + 1; if (!GetUserName(username, &usernameLength)) { - strcpy(username, "Player"); + strcpy(username, language_get_string(STR_PLAYER_DEFAULT_NAME)); } return username;