Disable addons and news manager in no graphics

This commit is contained in:
Benau 2018-09-13 00:58:45 +08:00
parent e5aa172d00
commit 930115a449

View File

@ -1632,6 +1632,8 @@ void initRest()
// online section of the add-ons manager will be initialised from a
// separate thread running in network HTTP.
#ifndef SERVER_ONLY
addons_manager = NULL;
if (!ProfileWorld::isNoGraphics())
addons_manager = new AddonsManager();
#endif
Online::ProfileManager::create();
@ -1643,6 +1645,7 @@ void initRest()
PlayerManager::create();
Online::RequestManager::get()->startNetworkThread();
#ifndef SERVER_ONLY
if (!ProfileWorld::isNoGraphics())
NewsManager::get(); // this will create the news manager
#endif
@ -1723,7 +1726,8 @@ void askForInternetPermission()
#ifndef SERVER_ONLY
bool need_to_start_news_manager =
UserConfigParams::m_internet_status !=
Online::RequestManager::IPERM_ALLOWED;
Online::RequestManager::IPERM_ALLOWED &&
!ProfileWorld::isNoGraphics();
UserConfigParams::m_internet_status =
Online::RequestManager::IPERM_ALLOWED;
if (need_to_start_news_manager)
@ -1953,6 +1957,8 @@ int main(int argc, char *argv[] )
exit(0);
#ifndef SERVER_ONLY
if (!ProfileWorld::isNoGraphics())
{
addons_manager->checkInstalledAddons();
// Load addons.xml to get info about add-ons even when not
@ -1974,6 +1980,7 @@ int main(int argc, char *argv[] )
}
}
}
}
#endif
if(UserConfigParams::m_unit_testing)
@ -2110,14 +2117,17 @@ int main(int argc, char *argv[] )
#ifndef SERVER_ONLY
// If an important news message exists it is shown in a popup dialog.
if (!ProfileWorld::isNoGraphics())
{
const core::stringw important_message =
NewsManager::get()->getImportantMessage();
if(important_message!="" && !NetworkConfig::get()->isServer())
if (important_message!="")
{
new MessageDialog(important_message,
MessageDialog::MESSAGE_DIALOG_OK,
NULL, true);
} // if important_message
}
#endif
// Replay a race
@ -2270,11 +2280,14 @@ static void cleanSuperTuxKart()
// the OS takes all threads down.
#ifndef SERVER_ONLY
if (!ProfileWorld::isNoGraphics())
{
if(!NewsManager::get()->waitForReadyToDeleted(2.0f))
{
Log::info("Thread", "News manager not stopping, exiting anyway.");
}
NewsManager::deallocate();
}
#endif
if(!Online::RequestManager::get()->waitForReadyToDeleted(5.0f))