mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-27 19:50:51 +00:00
Remove some of these superfluous ifdef checks.
Allows compatibility with non-curl enabled builds.
This commit is contained in:
parent
061e483df1
commit
2dd7854a9b
3 changed files with 8 additions and 21 deletions
|
@ -172,9 +172,7 @@ consvar_t cv_showjoinaddress = {"showjoinaddress", "On", CV_SAVE, CV_OnOff, NULL
|
||||||
static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}};
|
static CV_PossibleValue_t playbackspeed_cons_t[] = {{1, "MIN"}, {10, "MAX"}, {0, NULL}};
|
||||||
consvar_t cv_playbackspeed = {"playbackspeed", "1", 0, playbackspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_playbackspeed = {"playbackspeed", "1", 0, playbackspeed_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
|
||||||
consvar_t cv_httpsource = {"http_source", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
consvar_t cv_httpsource = {"http_source", "", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||||
#endif
|
|
||||||
|
|
||||||
static inline void *G_DcpyTiccmd(void* dest, const ticcmd_t* src, const size_t n)
|
static inline void *G_DcpyTiccmd(void* dest, const ticcmd_t* src, const size_t n)
|
||||||
{
|
{
|
||||||
|
@ -1356,6 +1354,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||||
UINT8 *p;
|
UINT8 *p;
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
size_t mirror_length;
|
size_t mirror_length;
|
||||||
|
const char *httpurl = cv_httpsource.string;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
netbuffer->packettype = PT_SERVERINFO;
|
netbuffer->packettype = PT_SERVERINFO;
|
||||||
|
@ -1389,9 +1388,7 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||||
netbuffer->u.serverinfo.iszone = 0;
|
netbuffer->u.serverinfo.iszone = 0;
|
||||||
|
|
||||||
memset(netbuffer->u.serverinfo.maptitle, 0, 33);
|
memset(netbuffer->u.serverinfo.maptitle, 0, 33);
|
||||||
#ifdef HAVE_CURL
|
|
||||||
memset(netbuffer->u.serverinfo.httpsource, 0, MAX_MIRROR_LENGTH);
|
memset(netbuffer->u.serverinfo.httpsource, 0, MAX_MIRROR_LENGTH);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU) && mapheaderinfo[gamemap-1]->lvlttl[0])
|
if (!(mapheaderinfo[gamemap-1]->menuflags & LF2_HIDEINMENU) && mapheaderinfo[gamemap-1]->lvlttl[0])
|
||||||
{
|
{
|
||||||
|
@ -1444,13 +1441,13 @@ static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||||
netbuffer->u.serverinfo.actnum = 0; //mapheaderinfo[gamemap-1]->actnum
|
netbuffer->u.serverinfo.actnum = 0; //mapheaderinfo[gamemap-1]->actnum
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
#ifdef HAVE_CURL
|
||||||
mirror_length = strlen(cv_httpsource.string);
|
mirror_length = strlen(httpurl);
|
||||||
if (mirror_length > MAX_MIRROR_LENGTH)
|
if (mirror_length > MAX_MIRROR_LENGTH)
|
||||||
mirror_length = MAX_MIRROR_LENGTH;
|
mirror_length = MAX_MIRROR_LENGTH;
|
||||||
|
|
||||||
if (snprintf(netbuffer->u.serverinfo.httpsource, MAX_MIRROR_LENGTH, "%s", cv_httpsource.string) < 0)
|
if (snprintf(netbuffer->u.serverinfo.httpsource, mirror_length, "%s", httpurl) < 0)
|
||||||
// If there's an encoding error, send nothing, we accept that the above may be truncated
|
// If there's an encoding error, send nothing, we accept that the above may be truncated
|
||||||
strncpy(netbuffer->u.serverinfo.httpsource, "", MAX_MIRROR_LENGTH);
|
strncpy(netbuffer->u.serverinfo.httpsource, "", mirror_length);
|
||||||
|
|
||||||
netbuffer->u.serverinfo.httpsource[MAX_MIRROR_LENGTH-1] = 0;
|
netbuffer->u.serverinfo.httpsource[MAX_MIRROR_LENGTH-1] = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2053,6 +2050,9 @@ static boolean CL_ServerConnectionSearchTicker(boolean viams, tic_t *asksent)
|
||||||
strncpy(http_source, serverlist[i].info.httpsource, MAX_MIRROR_LENGTH);
|
strncpy(http_source, serverlist[i].info.httpsource, MAX_MIRROR_LENGTH);
|
||||||
else
|
else
|
||||||
http_source[0] = '\0';
|
http_source[0] = '\0';
|
||||||
|
#else
|
||||||
|
if (serverlist[i].info.httpsource[0])
|
||||||
|
CONS_Printf("We received a http url from the server, however it will not be used as this build lacks curl support (%s)\n", serverlist[i].info.httpsource);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
D_ParseFileneeded(serverlist[i].info.fileneedednum, serverlist[i].info.fileneeded, 0);
|
D_ParseFileneeded(serverlist[i].info.fileneedednum, serverlist[i].info.fileneeded, 0);
|
||||||
|
@ -3980,9 +3980,6 @@ static void HandleServerInfo(SINT8 node)
|
||||||
netbuffer->u.serverinfo.time = (tic_t)LONG(ticdiff);
|
netbuffer->u.serverinfo.time = (tic_t)LONG(ticdiff);
|
||||||
netbuffer->u.serverinfo.servername[MAXSERVERNAME-1] = 0;
|
netbuffer->u.serverinfo.servername[MAXSERVERNAME-1] = 0;
|
||||||
netbuffer->u.serverinfo.gametype = (UINT8)((netbuffer->u.serverinfo.gametype == VANILLA_GT_MATCH) ? GT_MATCH : GT_RACE);
|
netbuffer->u.serverinfo.gametype = (UINT8)((netbuffer->u.serverinfo.gametype == VANILLA_GT_MATCH) ? GT_MATCH : GT_RACE);
|
||||||
#ifdef HAVE_CURL
|
|
||||||
netbuffer->u.serverinfo.httpsource[MAX_MIRROR_LENGTH-1] = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SL_InsertServer(&netbuffer->u.serverinfo, node);
|
SL_InsertServer(&netbuffer->u.serverinfo, node);
|
||||||
}
|
}
|
||||||
|
|
|
@ -367,9 +367,7 @@ typedef struct
|
||||||
|
|
||||||
#define MAXSERVERNAME 32
|
#define MAXSERVERNAME 32
|
||||||
#define MAXFILENEEDED 915
|
#define MAXFILENEEDED 915
|
||||||
#ifdef HAVE_CURL
|
|
||||||
#define MAX_MIRROR_LENGTH 256
|
#define MAX_MIRROR_LENGTH 256
|
||||||
#endif
|
|
||||||
// This packet is too large
|
// This packet is too large
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -391,9 +389,7 @@ typedef struct
|
||||||
unsigned char mapmd5[16];
|
unsigned char mapmd5[16];
|
||||||
UINT8 actnum;
|
UINT8 actnum;
|
||||||
UINT8 iszone;
|
UINT8 iszone;
|
||||||
#ifdef HAVE_CURL
|
char httpsource[MAX_MIRROR_LENGTH]; // HTTP URL to download from, always defined for compatibility
|
||||||
char httpsource[MAX_MIRROR_LENGTH];
|
|
||||||
#endif
|
|
||||||
UINT8 fileneeded[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
|
UINT8 fileneeded[MAXFILENEEDED]; // is filled with writexxx (byteptr.h)
|
||||||
} ATTRPACK serverinfo_pak;
|
} ATTRPACK serverinfo_pak;
|
||||||
|
|
||||||
|
@ -501,11 +497,7 @@ extern INT32 mapchangepending;
|
||||||
|
|
||||||
// Points inside doomcom
|
// Points inside doomcom
|
||||||
extern doomdata_t *netbuffer;
|
extern doomdata_t *netbuffer;
|
||||||
|
|
||||||
#ifdef HAVE_CURL
|
|
||||||
extern consvar_t cv_httpsource;
|
extern consvar_t cv_httpsource;
|
||||||
#endif
|
|
||||||
|
|
||||||
extern consvar_t cv_showjoinaddress;
|
extern consvar_t cv_showjoinaddress;
|
||||||
extern consvar_t cv_playbackspeed;
|
extern consvar_t cv_playbackspeed;
|
||||||
|
|
||||||
|
|
|
@ -686,9 +686,7 @@ void D_RegisterServerCommands(void)
|
||||||
CV_RegisterVar(&cv_maxsend);
|
CV_RegisterVar(&cv_maxsend);
|
||||||
CV_RegisterVar(&cv_noticedownload);
|
CV_RegisterVar(&cv_noticedownload);
|
||||||
CV_RegisterVar(&cv_downloadspeed);
|
CV_RegisterVar(&cv_downloadspeed);
|
||||||
#ifdef HAVE_CURL
|
|
||||||
CV_RegisterVar(&cv_httpsource);
|
CV_RegisterVar(&cv_httpsource);
|
||||||
#endif
|
|
||||||
#ifndef NONET
|
#ifndef NONET
|
||||||
CV_RegisterVar(&cv_allownewplayer);
|
CV_RegisterVar(&cv_allownewplayer);
|
||||||
#ifdef VANILLAJOINNEXTROUND
|
#ifdef VANILLAJOINNEXTROUND
|
||||||
|
|
Loading…
Reference in a new issue