Define SERVER_URL_PROTOCOL const for easy reconfiguration

This commit is contained in:
fickleheart 2020-03-21 07:47:29 -05:00
parent feb18208cb
commit f32ab5918e
3 changed files with 7 additions and 3 deletions

View File

@ -895,7 +895,7 @@ static void IdentifyVersion(void)
{
size_t i;
CONS_Printf("srb2:// connect links load game files from the SRB2 application's stored directory. Switching to ");
CONS_Printf("%s connect links load game files from the SRB2 application's stored directory. Switching to ", SERVER_URL_PROTOCOL);
strlcpy(srb2path, myargv[0], sizeof(srb2path));
// Get just the directory, minus the EXE name

View File

@ -150,6 +150,9 @@ extern char logfilename[1024];
// Otherwise we can't force updates!
#endif
/* A custom URL protocol for server links. */
#define SERVER_URL_PROTOCOL "srb2://"
// Does this version require an added patch file?
// Comment or uncomment this as necessary.
#define USE_PATCH_DTA

View File

@ -41,12 +41,13 @@ static INT32 found;
const char *M_GetUrlProtocolArg(void)
{
INT32 i;
const size_t len = strlen(SERVER_URL_PROTOCOL);
for (i = 1; i < myargc; i++)
{
if (!strnicmp(myargv[i], "srb2://", 7))
if (strlen(myargv[i]) > len && !strnicmp(myargv[i], SERVER_URL_PROTOCOL, len))
{
return &myargv[i][7];
return &myargv[i][len];
}
}