Made the server list URL customizable

This commit is contained in:
yvt 2013-12-02 22:04:56 +09:00
parent 6106343f43
commit 920d95b251
2 changed files with 6 additions and 5 deletions

View File

@ -26,10 +26,11 @@
#include <curl/curl.h>
#include <json/json.h>
#include "MainScreen.h"
#include <Core/Settings.h>
#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 ) ) {

View File

@ -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 ) ) {