1
0
forked from 0ad/0ad

Read default multiplayer server name/IP address from config. Patch by Aurium. Refs #1778.

This was SVN commit r13003.
This commit is contained in:
leper 2012-12-20 21:44:56 +00:00
parent 6ab0ab586a
commit 9a2dfa3fc0
5 changed files with 24 additions and 7 deletions

View File

@ -30,6 +30,9 @@ pauseonfocusloss = true
; Default player name to use in multiplayer ; Default player name to use in multiplayer
; playername = "anonymous" ; playername = "anonymous"
; Default server name or IP to use in multiplayer
multiplayerserver = "127.0.0.1"
; Force a particular resolution. (If these are 0, the default is ; Force a particular resolution. (If these are 0, the default is
; to keep the current desktop resolution in fullscreen mode or to ; to keep the current desktop resolution in fullscreen mode or to
; use 1024x768 in windowed mode.) ; use 1024x768 in windowed mode.)
@ -241,7 +244,7 @@ hotkey.selection.group.add.9 = "Shift+9"
; > SESSION CONTROLS ; > SESSION CONTROLS
hotkey.session.kill = Delete ; Destroy selected units hotkey.session.kill = Delete ; Destroy selected units
hotkey.session.attack = Ctrl ; Modifier to force attack instead of another action hotkey.session.attack = Ctrl ; Modifier to force attack instead of another action
hotkey.session.garrison = Ctrl ; Modifier to garrison when clicking on building hotkey.session.garrison = Ctrl ; Modifier to garrison when clicking on building
hotkey.session.queue = Shift ; Modifier to queue unit orders instead of replacing hotkey.session.queue = Shift ; Modifier to queue unit orders instead of replacing
hotkey.session.batchtrain = Shift ; Modifier to train units in batches hotkey.session.batchtrain = Shift ; Modifier to train units in batches

View File

@ -40,7 +40,9 @@
</object> </object>
<object name="joinIP" type="input" size="210 80 100%-32 104" style="StoneInput"> <object name="joinIP" type="input" size="210 80 100%-32 104" style="StoneInput">
127.0.0.1 <action on="Load"><![CDATA[
this.caption = Engine.GetDefaultMPServer();
]]></action>
</object>3 100%-33 103 100%-3 </object>3 100%-33 103 100%-3
<object type="button" size="50%-144 100%-60 50%-16 100%-32" style="StoneButton"> <object type="button" size="50%-144 100%-60 50%-16 100%-32" style="StoneButton">

View File

@ -179,6 +179,12 @@ std::wstring GetDefaultPlayerName(void* UNUSED(cbdata))
return name; return name;
} }
std::wstring GetDefaultMPServer(void* UNUSED(cbdata))
{
std::wstring server = g_MPServer.FromUTF8();
return server;
}
void StartNetworkGame(void* UNUSED(cbdata)) void StartNetworkGame(void* UNUSED(cbdata))
{ {
ENSURE(g_NetServer); ENSURE(g_NetServer);
@ -634,6 +640,7 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
scriptInterface.RegisterFunction<std::wstring, std::wstring, &SetCursor>("SetCursor"); scriptInterface.RegisterFunction<std::wstring, std::wstring, &SetCursor>("SetCursor");
scriptInterface.RegisterFunction<int, &GetPlayerID>("GetPlayerID"); scriptInterface.RegisterFunction<int, &GetPlayerID>("GetPlayerID");
scriptInterface.RegisterFunction<std::wstring, &GetDefaultPlayerName>("GetDefaultPlayerName"); scriptInterface.RegisterFunction<std::wstring, &GetDefaultPlayerName>("GetDefaultPlayerName");
scriptInterface.RegisterFunction<std::wstring, &GetDefaultMPServer>("GetDefaultMPServer");
scriptInterface.RegisterFunction<void, std::string, &OpenURL>("OpenURL"); scriptInterface.RegisterFunction<void, std::string, &OpenURL>("OpenURL");
scriptInterface.RegisterFunction<void, &RestartInAtlas>("RestartInAtlas"); scriptInterface.RegisterFunction<void, &RestartInAtlas>("RestartInAtlas");
scriptInterface.RegisterFunction<bool, &AtlasIsAvailable>("AtlasIsAvailable"); scriptInterface.RegisterFunction<bool, &AtlasIsAvailable>("AtlasIsAvailable");

View File

@ -35,6 +35,7 @@ bool g_NoGLVBO = false;
bool g_PauseOnFocusLoss = false; bool g_PauseOnFocusLoss = false;
CStr g_PlayerName = ""; CStr g_PlayerName = "";
CStr g_MPServer = "";
bool g_Shadows = false; bool g_Shadows = false;
bool g_ShadowPCF = false; bool g_ShadowPCF = false;
@ -86,9 +87,10 @@ static void LoadGlobals()
CFG_GET_USER_VAL("novbo", Bool, g_NoGLVBO); CFG_GET_USER_VAL("novbo", Bool, g_NoGLVBO);
CFG_GET_USER_VAL("pauseonfocusloss", Bool, g_PauseOnFocusLoss); CFG_GET_USER_VAL("pauseonfocusloss", Bool, g_PauseOnFocusLoss);
CFG_GET_USER_VAL("playername", String, g_PlayerName); CFG_GET_USER_VAL("playername", String, g_PlayerName);
CFG_GET_USER_VAL("multiplayerserver", String, g_MPServer);
CFG_GET_USER_VAL("shadows", Bool, g_Shadows); CFG_GET_USER_VAL("shadows", Bool, g_Shadows);
CFG_GET_USER_VAL("shadowpcf", Bool, g_ShadowPCF); CFG_GET_USER_VAL("shadowpcf", Bool, g_ShadowPCF);
CFG_GET_USER_VAL("waternormals",Bool, g_WaterNormal); CFG_GET_USER_VAL("waternormals",Bool, g_WaterNormal);
CFG_GET_USER_VAL("waterrealdepth",Bool, g_WaterRealDepth); CFG_GET_USER_VAL("waterrealdepth",Bool, g_WaterRealDepth);
CFG_GET_USER_VAL("waterfoam",Bool, g_WaterFoam); CFG_GET_USER_VAL("waterfoam",Bool, g_WaterFoam);
@ -109,9 +111,9 @@ static void LoadGlobals()
float musicGain = 0.5f; float musicGain = 0.5f;
float ambientGain = 0.5f; float ambientGain = 0.5f;
float actionGain = 0.5f; float actionGain = 0.5f;
int bufferCount = 50; int bufferCount = 50;
unsigned long bufferSize = 65536; unsigned long bufferSize = 65536;
CFG_GET_USER_VAL("sound.mastergain", Float, gain); CFG_GET_USER_VAL("sound.mastergain", Float, gain);
CFG_GET_USER_VAL("sound.musicgain", Float, musicGain); CFG_GET_USER_VAL("sound.musicgain", Float, musicGain);
CFG_GET_USER_VAL("sound.ambientgain", Float, ambientGain); CFG_GET_USER_VAL("sound.ambientgain", Float, ambientGain);
@ -120,7 +122,7 @@ static void LoadGlobals()
CFG_GET_USER_VAL("sound.bufferCount", Int, bufferCount); CFG_GET_USER_VAL("sound.bufferCount", Int, bufferCount);
CFG_GET_USER_VAL("sound.bufferSize", UnsignedLong, bufferSize); CFG_GET_USER_VAL("sound.bufferSize", UnsignedLong, bufferSize);
if ( g_SoundManager ) { if (g_SoundManager) {
g_SoundManager->SetMasterGain(gain); g_SoundManager->SetMasterGain(gain);
g_SoundManager->SetMusicGain(musicGain); g_SoundManager->SetMusicGain(musicGain);
g_SoundManager->SetAmbientGain(ambientGain); g_SoundManager->SetAmbientGain(ambientGain);

View File

@ -47,6 +47,9 @@ extern bool g_PauseOnFocusLoss;
// default player name to use in multiplayer // default player name to use in multiplayer
extern CStr g_PlayerName; extern CStr g_PlayerName;
// default server name or IP to use in multiplayer
extern CStr g_MPServer;
// flag to switch on shadows // flag to switch on shadows
extern bool g_Shadows; extern bool g_Shadows;