@@ -203,6 +203,7 @@ CClientGame::CClientGame ( bool bLocalPlay )
203203 m_pZoneNames = new CZoneNames;
204204 m_pScriptKeyBinds = new CScriptKeyBinds;
205205 m_pRemoteCalls = new CRemoteCalls ();
206+ m_pResourceFileDownloadManager = new CResourceFileDownloadManager ();
206207
207208 // Create our net API
208209 m_pNetAPI = new CNetAPI ( m_pManager );
@@ -475,6 +476,7 @@ CClientGame::~CClientGame ( void )
475476 SAFE_DELETE ( m_pRemoteCalls );
476477 SAFE_DELETE ( m_pLuaManager );
477478 SAFE_DELETE ( m_pLatentTransferManager );
479+ SAFE_DELETE ( m_pResourceFileDownloadManager );
478480
479481 SAFE_DELETE ( m_pRootEntity );
480482
@@ -1181,7 +1183,7 @@ void CClientGame::DoPulses ( void )
11811183 else if ( m_Status == CClientGame::STATUS_JOINED )
11821184 {
11831185 // Pulse DownloadFiles if we're transferring stuff
1184- DownloadInitialResourceFiles ();
1186+ GetResourceFileDownloadManager ()-> DoPulse ();
11851187 DownloadSingularResourceFiles ();
11861188 g_pNet->GetHTTPDownloadManager ( EDownloadMode::CALL_REMOTE )->ProcessQueuedFiles ();
11871189 }
@@ -4025,79 +4027,6 @@ bool CClientGame::ProcessCollisionHandler ( CEntitySAInterface* pThisInterface,
40254027}
40264028
40274029
4028- // Set flag and transfer box visibility
4029- void CClientGame::SetTransferringInitialFiles ( bool bTransfer, int iDownloadPriorityGroup )
4030- {
4031- m_bTransferringInitialFiles = bTransfer;
4032- m_iActiveDownloadPriorityGroup = bTransfer ? iDownloadPriorityGroup : INVALID_DOWNLOAD_PRIORITY_GROUP;
4033- if ( bTransfer )
4034- m_pTransferBox->Show ();
4035- else
4036- m_pTransferBox->Hide ();
4037- }
4038-
4039-
4040- // Get Download Priority Group of resources that are DOWNLOADING RIGHT NOW!
4041- int CClientGame::GetActiveDownloadPriorityGroup ( void )
4042- {
4043- return m_bTransferringInitialFiles ? m_iActiveDownloadPriorityGroup : INVALID_DOWNLOAD_PRIORITY_GROUP;
4044- }
4045-
4046-
4047- //
4048- // Downloading initial resource files
4049- //
4050- void CClientGame::DownloadInitialResourceFiles ( void )
4051- {
4052- if ( !IsTransferringInitialFiles () )
4053- return ;
4054-
4055- if ( !g_pNet->IsConnected () )
4056- return ;
4057-
4058- CNetHTTPDownloadManagerInterface* pHTTP = g_pNet->GetHTTPDownloadManager ( EDownloadMode::RESOURCE_INITIAL_FILES );
4059- if ( !pHTTP->ProcessQueuedFiles () )
4060- {
4061- // Downloading
4062- m_pTransferBox->SetInfo ( pHTTP->GetDownloadSizeNow () );
4063- m_pTransferBox->DoPulse ();
4064- }
4065- else
4066- {
4067- // This will also hide the transfer box
4068- SetTransferringInitialFiles ( false );
4069-
4070- // Get the last error to occur in the HTTP Manager
4071- const char * szHTTPError = pHTTP->GetError ();
4072-
4073- // Was an error found?
4074- if ( strlen (szHTTPError) == 0 )
4075- {
4076- // Load our ("unavailable"-flagged) resources, and make them available
4077- m_pResourceManager->OnDownloadGroupFinished ();
4078- }
4079- else
4080- {
4081- g_pCore->GetConsole ()->Printf ( _ (" Download error: %s" ), szHTTPError );
4082- if ( g_pClientGame->IsUsingExternalHTTPServer () && !g_pCore->ShouldUseInternalHTTPServer () )
4083- {
4084- SString strMessage ( " External HTTP file download error:%s (Reconnecting with internal HTTP)" , szHTTPError );
4085- g_pClientGame->TellServerSomethingImportant ( 1006 , strMessage, true );
4086- g_pCore->Reconnect ( " " , 0 , NULL , false , true );
4087- }
4088- else
4089- {
4090- // Throw the error and disconnect
4091- AddReportLog ( 7106 , SString ( " Game - HTTPError (%s)" , szHTTPError ) );
4092-
4093- g_pCore->GetModManager ()->RequestUnload ();
4094- g_pCore->ShowMessageBox ( _ (" Error" )+_E (" CD20" ), szHTTPError, MB_BUTTON_OK | MB_ICON_ERROR ); // HTTP Error
4095- }
4096- }
4097- }
4098- }
4099-
4100-
41014030//
41024031// On demand files
41034032//
@@ -6457,8 +6386,6 @@ void CClientGame::OutputServerInfo( void )
64576386{
64586387 SString strTotalOutput;
64596388 strTotalOutput += SString ( " Server info for %s" , g_pNet->GetConnectedServer ( true ) );
6460- if ( IsUsingExternalHTTPServer () )
6461- strTotalOutput += " (External HTTP)" ;
64626389 strTotalOutput += " \n " ;
64636390 strTotalOutput += SString ( " Ver: %s\n " , *GetServerVersionSortable () );
64646391 strTotalOutput += SString ( " AC: %s\n " , *m_strACInfo );
0 commit comments