From 920d95b251d2319adc10b6f47c40505c33dd24db Mon Sep 17 00:00:00 2001 From: yvt Date: Mon, 2 Dec 2013 22:04:56 +0900 Subject: [PATCH] Made the server list URL customizable --- Sources/Gui/MainScreenHelper.cpp | 5 +++-- Sources/Gui/Serverbrowser.cpp | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Sources/Gui/MainScreenHelper.cpp b/Sources/Gui/MainScreenHelper.cpp index be2507c9..73d3d867 100644 --- a/Sources/Gui/MainScreenHelper.cpp +++ b/Sources/Gui/MainScreenHelper.cpp @@ -26,10 +26,11 @@ #include #include #include "MainScreen.h" +#include #include "MainWindow.h" // for credits -#define SERVICE_URL "http://services.buildandshoot.com/serverlist.json" +SPADES_SETTING(cl_serverListUrl, "http://services.buildandshoot.com/serverlist.json"); namespace spades { namespace gui { @@ -93,7 +94,7 @@ namespace spades { if( cHandle ) { try{ curl_easy_setopt( cHandle, CURLOPT_USERAGENT, OpenSpades_VER_STR ); - curl_easy_setopt( cHandle, CURLOPT_URL, SERVICE_URL ); + curl_easy_setopt( cHandle, CURLOPT_URL, cl_serverListUrl.CString() ); curl_easy_setopt( cHandle, CURLOPT_WRITEFUNCTION, &ServerListQuery::curlWriteCallback ); curl_easy_setopt( cHandle, CURLOPT_WRITEDATA, this ); if( 0 == curl_easy_perform( cHandle ) ) { diff --git a/Sources/Gui/Serverbrowser.cpp b/Sources/Gui/Serverbrowser.cpp index 0c701009..84ee1c52 100644 --- a/Sources/Gui/Serverbrowser.cpp +++ b/Sources/Gui/Serverbrowser.cpp @@ -34,10 +34,10 @@ SPADES_SETTING2(cg_protocolVersion, "", "The protocol version to use, 3 = 0.75, SPADES_SETTING(cg_serverlistFilter, "31"); SPADES_SETTING(cg_serverlistSort, "16385"); //0x4001 (sort on players, descending) -#define SERVICE_URL "http://services.buildandshoot.com/serverlist.json" - #define COLUMN_CHAR "\t" +SPADES_SETTING(cl_serverListUrl, "http://services.buildandshoot.com/serverlist.json"); + namespace spades { @@ -186,7 +186,7 @@ void Serverbrowser::Run() mBrowser->add( "Fetching servers, please wait..." ); mBuffer = ""; curl_easy_setopt( cHandle, CURLOPT_USERAGENT, OpenSpades_VER_STR ); - curl_easy_setopt( cHandle, CURLOPT_URL, SERVICE_URL ); + curl_easy_setopt( cHandle, CURLOPT_URL, cl_serverListUrl.CString() ); curl_easy_setopt( cHandle, CURLOPT_WRITEFUNCTION, &Serverbrowser::curlWriteCallback ); curl_easy_setopt( cHandle, CURLOPT_WRITEDATA, this ); if( 0 == curl_easy_perform( cHandle ) ) {