Made the 'enable internet' button work.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8088 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2011-03-27 21:02:00 +00:00
parent 6867018d52
commit b2ab95ff16
2 changed files with 10 additions and 0 deletions

View File

@@ -63,6 +63,10 @@ NetworkHttp::NetworkHttp() : m_news(std::vector<NewsMessage>()),
m_progress(-1.0f), m_abort(false)
{
m_current_news_message = -1;
// Don't even start the network threads if networking is disabled.
if(!UserConfigParams::m_enable_internet)
return;
pthread_mutex_init(&m_mutex_command, NULL);
pthread_cond_init(&m_cond_command, NULL);
@@ -173,6 +177,9 @@ void *NetworkHttp::mainLoop(void *obj)
*/
NetworkHttp::~NetworkHttp()
{
if(!UserConfigParams::m_enable_internet)
return;
// if a download should be active (which means it was cancelled by the
// user, in which case it will still be ongoing in the background)
// we can't get the mutex, and would have to wait for a timeout,

View File

@@ -17,6 +17,7 @@
#include "states_screens/options_screen_ui.hpp"
#include "addons/network_http.hpp"
#include "audio/music_manager.hpp"
#include "audio/sfx_manager.hpp"
#include "audio/sfx_base.hpp"
@@ -181,7 +182,9 @@ void OptionsScreenUI::eventCallback(Widget* widget, const std::string& name, con
{
CheckBoxWidget* news = getWidget<CheckBoxWidget>("enable-internet");
assert( news != NULL );
delete network_http;
UserConfigParams::m_enable_internet = news->getState();
network_http = new NetworkHttp();
}
} // eventCallback