engine: client: do not rely on host.downloadcount when connecting to the server with HTTP enabled
* Replace cl.downloadUrl by cl.http_download
This commit is contained in:
parent
caf14c1b7c
commit
3e1209d3a4
3 changed files with 17 additions and 18 deletions
|
@ -70,16 +70,17 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( cl.downloadUrl[0] )
|
host.downloadcount++;
|
||||||
|
|
||||||
|
if( cl.http_download )
|
||||||
{
|
{
|
||||||
HTTP_AddDownload( filepath, pResource->nDownloadSize, true );
|
HTTP_AddDownload( filepath, pResource->nDownloadSize, true );
|
||||||
host.downloadcount++;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
MSG_BeginClientCmd( msg, clc_stringcmd );
|
{
|
||||||
MSG_WriteStringf( msg, "dlfile %s", filepath );
|
MSG_BeginClientCmd( msg, clc_stringcmd );
|
||||||
host.downloadcount++;
|
MSG_WriteStringf( msg, "dlfile %s", filepath );
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -458,6 +458,7 @@ void CL_BatchResourceRequest( qboolean initialize )
|
||||||
byte data[MAX_INIT_MSG];
|
byte data[MAX_INIT_MSG];
|
||||||
resource_t *p, *n;
|
resource_t *p, *n;
|
||||||
sizebuf_t msg;
|
sizebuf_t msg;
|
||||||
|
qboolean done_downloading = true;
|
||||||
|
|
||||||
MSG_Init( &msg, "Resource Batch", data, sizeof( data ));
|
MSG_Init( &msg, "Resource Batch", data, sizeof( data ));
|
||||||
|
|
||||||
|
@ -487,7 +488,10 @@ void CL_BatchResourceRequest( qboolean initialize )
|
||||||
case t_model:
|
case t_model:
|
||||||
case t_eventscript:
|
case t_eventscript:
|
||||||
if( !CL_CheckFile( &msg, p ))
|
if( !CL_CheckFile( &msg, p ))
|
||||||
|
{
|
||||||
|
done_downloading = false;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
CL_MoveToOnHandList( p );
|
CL_MoveToOnHandList( p );
|
||||||
break;
|
break;
|
||||||
case t_skin:
|
case t_skin:
|
||||||
|
@ -501,6 +505,7 @@ void CL_BatchResourceRequest( qboolean initialize )
|
||||||
MSG_BeginClientCmd( &msg, clc_stringcmd );
|
MSG_BeginClientCmd( &msg, clc_stringcmd );
|
||||||
MSG_WriteStringf( &msg, "dlfile !MD5%s", MD5_Print( p->rgucMD5_hash ));;
|
MSG_WriteStringf( &msg, "dlfile !MD5%s", MD5_Print( p->rgucMD5_hash ));;
|
||||||
SetBits( p->ucFlags, RES_REQUESTED );
|
SetBits( p->ucFlags, RES_REQUESTED );
|
||||||
|
done_downloading = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -525,11 +530,7 @@ void CL_BatchResourceRequest( qboolean initialize )
|
||||||
|
|
||||||
if( cls.state != ca_disconnected )
|
if( cls.state != ca_disconnected )
|
||||||
{
|
{
|
||||||
if( !cl.downloadUrl[0] && !MSG_GetNumBytesWritten( &msg ) && CL_PrecacheResources( ))
|
if( done_downloading && CL_PrecacheResources( ))
|
||||||
{
|
|
||||||
CL_RegisterResources( &msg );
|
|
||||||
}
|
|
||||||
if( cl.downloadUrl[0] && host.downloadcount == 0 && CL_PrecacheResources( ) )
|
|
||||||
{
|
{
|
||||||
CL_RegisterResources( &msg );
|
CL_RegisterResources( &msg );
|
||||||
}
|
}
|
||||||
|
@ -1840,13 +1841,10 @@ void CL_ParseResLocation( sizebuf_t *msg )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while( ( data = COM_ParseFile( data, token, sizeof( token ) ) ) )
|
while(( data = COM_ParseFile( data, token, sizeof( token ))))
|
||||||
{
|
{
|
||||||
Con_Reportf( "Adding %s as download location\n", token );
|
Con_Reportf( "Adding %s as download location\n", token );
|
||||||
|
cl.http_download = true;
|
||||||
if( !cl.downloadUrl[0] )
|
|
||||||
Q_strncpy( cl.downloadUrl, token, sizeof( token ) );
|
|
||||||
|
|
||||||
HTTP_AddCustomServer( token );
|
HTTP_AddCustomServer( token );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ typedef struct
|
||||||
char serverinfo[MAX_SERVERINFO_STRING];
|
char serverinfo[MAX_SERVERINFO_STRING];
|
||||||
player_info_t players[MAX_CLIENTS]; // collected info about all other players include himself
|
player_info_t players[MAX_CLIENTS]; // collected info about all other players include himself
|
||||||
double lastresourcecheck;
|
double lastresourcecheck;
|
||||||
string downloadUrl;
|
qboolean http_download;
|
||||||
event_state_t events;
|
event_state_t events;
|
||||||
|
|
||||||
// predicting stuff but not only...
|
// predicting stuff but not only...
|
||||||
|
|
Loading…
Add table
Reference in a new issue