Ticket #1778: 0ad-adding-GetDefaultMPServer.diff
File 0ad-adding-GetDefaultMPServer.diff, 2.9 KB (added by , 11 years ago) |
---|
-
source/ps/GameSetup/Config.cpp
35 35 36 36 bool g_PauseOnFocusLoss = false; 37 37 CStr g_PlayerName = ""; 38 CStr g_MPServer = ""; 38 39 39 40 bool g_Shadows = false; 40 41 bool g_ShadowPCF = false; … … 86 87 CFG_GET_USER_VAL("novbo", Bool, g_NoGLVBO); 87 88 CFG_GET_USER_VAL("pauseonfocusloss", Bool, g_PauseOnFocusLoss); 88 89 CFG_GET_USER_VAL("playername", String, g_PlayerName); 90 CFG_GET_USER_VAL("multiplayerserver", String, g_MPServer); 89 91 CFG_GET_USER_VAL("shadows", Bool, g_Shadows); 90 92 CFG_GET_USER_VAL("shadowpcf", Bool, g_ShadowPCF); 91 93 -
source/ps/GameSetup/Config.h
47 47 // default player name to use in multiplayer 48 48 extern CStr g_PlayerName; 49 49 50 // default server name or IP to use in multiplayer 51 extern CStr g_MPServer; 52 50 53 // flag to switch on shadows 51 54 extern bool g_Shadows; 52 55 -
source/gui/scripting/ScriptFunctions.cpp
179 179 return name; 180 180 } 181 181 182 std::wstring GetDefaultMPServer(void* UNUSED(cbdata)) 183 { 184 std::wstring server = g_MPServer.FromUTF8(); 185 if (server.empty()) 186 server = L"127.0.0.1"; 187 return server; 188 } 189 182 190 void StartNetworkGame(void* UNUSED(cbdata)) 183 191 { 184 192 ENSURE(g_NetServer); … … 634 642 scriptInterface.RegisterFunction<std::wstring, std::wstring, &SetCursor>("SetCursor"); 635 643 scriptInterface.RegisterFunction<int, &GetPlayerID>("GetPlayerID"); 636 644 scriptInterface.RegisterFunction<std::wstring, &GetDefaultPlayerName>("GetDefaultPlayerName"); 645 scriptInterface.RegisterFunction<std::wstring, &GetDefaultMPServer>("GetDefaultMPServer"); 637 646 scriptInterface.RegisterFunction<void, std::string, &OpenURL>("OpenURL"); 638 647 scriptInterface.RegisterFunction<void, &RestartInAtlas>("RestartInAtlas"); 639 648 scriptInterface.RegisterFunction<bool, &AtlasIsAvailable>("AtlasIsAvailable"); -
binaries/data/mods/public/gui/gamesetup/gamesetup_mp.xml
40 40 </object> 41 41 42 42 <object name="joinIP" type="input" size="210 80 100%-32 104" style="StoneInput"> 43 127.0.0.1 43 <action on="Load"><![CDATA[ 44 this.caption = Engine.GetDefaultMPServer(); 45 ]]></action> 44 46 </object>3 100%-33 103 100%-3 45 47 46 48 <object type="button" size="50%-144 100%-60 50%-16 100%-32" style="StoneButton">