1
0
forked from 0ad/0ad

Load default MP player name from the config.

This was SVN commit r12673.
This commit is contained in:
Deiz 2012-09-14 05:38:29 +00:00
parent 8bd54eef71
commit f91111aec8
4 changed files with 12 additions and 2 deletions

View File

@ -23,6 +23,9 @@ windowed = false
; Pause the game on window focus loss (Only applicable to single player mode)
pauseonfocusloss = true
; Default player name to use in multiplayer
; playername = "anonymous"
; Force a particular resolution. (If these are 0, the default is
; to keep the current desktop resolution in fullscreen mode or to
; use 1024x768 in windowed mode.)

View File

@ -169,8 +169,10 @@ int GetPlayerID(void* UNUSED(cbdata))
std::wstring GetDefaultPlayerName(void* UNUSED(cbdata))
{
// TODO: this should come from a config file or something
std::wstring name = sys_get_user_name();
std::wstring name = g_PlayerName.FromUTF8();
if (name.empty())
name = sys_get_user_name();
if (name.empty())
name = L"anonymous";
return name;

View File

@ -34,6 +34,7 @@ bool g_NoGLAutoMipmap = false;
bool g_NoGLVBO = false;
bool g_PauseOnFocusLoss = false;
CStr g_PlayerName = "";
bool g_Shadows = false;
bool g_ShadowPCF = false;
@ -76,6 +77,7 @@ static void LoadGlobals()
CFG_GET_USER_VAL("noautomipmap", Bool, g_NoGLAutoMipmap);
CFG_GET_USER_VAL("novbo", Bool, g_NoGLVBO);
CFG_GET_USER_VAL("pauseonfocusloss", Bool, g_PauseOnFocusLoss);
CFG_GET_USER_VAL("playername", String, g_PlayerName);
CFG_GET_USER_VAL("shadows", Bool, g_Shadows);
CFG_GET_USER_VAL("shadowpcf", Bool, g_ShadowPCF);
CFG_GET_USER_VAL("fancywater", Bool, g_FancyWater);

View File

@ -44,6 +44,9 @@ extern bool g_NoGLVBO;
// flag to pause the game on window focus loss
extern bool g_PauseOnFocusLoss;
// default player name to use in multiplayer
extern CStr g_PlayerName;
// flag to switch on shadows
extern bool g_Shadows;
// flag to switch on reflective/refractive water