Fix addons when we are offline:

- They can't be updated
- It doesn't crash when we uninstall them

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@6483 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
xapantu
2010-11-09 17:04:58 +00:00
parent 54643a6d6b
commit 23143a4018
2 changed files with 9 additions and 5 deletions

View File

@@ -50,6 +50,8 @@ Addons::Addons()
m_download_state = download_state;
pthread_mutex_init(&m_str_mutex, NULL);
/*It is _very_ dirty to save the list as a locale file since we have a
function to load it directly in a string.*/
download("list");
std::string xml_file = file_manager->getConfigDir() + "/" + "list";
std::cout << xml_file << std::endl;
@@ -167,6 +169,7 @@ void Addons::GetInstalledAddons()
addons.type = xml->getNodeName();
addons.name = name;
addons.installed_version = version;
addons.version = version;
addons.installed = true;
this->m_addons_list.push_back(addons);
}

View File

@@ -88,11 +88,12 @@ void AddonsLoading::loadInfo()
void * AddonsLoading::downloadIcon( void * pthis)
{
AddonsLoading * pt = (AddonsLoading*)pthis;
download("icon/" + pt->addons->GetIcon(), pt->addons->GetName() + ".png");
pthread_mutex_lock(&(pt->m_mutex_can_install));
pt->m_can_load_icon = true;
pthread_mutex_unlock(&(pt->m_mutex_can_install));
if(download("icon/" + pt->addons->GetIcon(), pt->addons->GetName() + ".png"))
{
pthread_mutex_lock(&(pt->m_mutex_can_install));
pt->m_can_load_icon = true;
pthread_mutex_unlock(&(pt->m_mutex_can_install));
}
return NULL;
}