}
#endif
-AddonManager::AddonManager() :
+AddonManager::AddonManager(std::vector<std::string>& ignored_addon_filenames_) :
addons(),
- ignored_addon_filenames()
+ ignored_addon_filenames(ignored_addon_filenames_)
{
#ifdef HAVE_LIBCURL
curl_global_init(CURL_GLOBAL_ALL);
addons.push_back(addon);
// check if the Addon is disabled
- if (std::find(ignored_addon_filenames.begin(), ignored_addon_filenames.end(), fileName) != ignored_addon_filenames.end()) {
+ if (std::find(ignored_addon_filenames.begin(), ignored_addon_filenames.end(), fileName) != ignored_addon_filenames.end())
+ {
unload(addon);
}
PHYSFS_freeList(rc);
}
-void
-AddonManager::read(const Reader& lisp)
-{
- lisp.get("disabled-addons", ignored_addon_filenames);
-}
-
-void
-AddonManager::write(lisp::Writer& writer)
-{
- writer.write("disabled-addons", ignored_addon_filenames);
-}
-
/* EOF */
class AddonManager : public Currenton<AddonManager>
{
public:
- AddonManager();
+ AddonManager(std::vector<std::string>& ignored_addon_filenames_);
~AddonManager();
/**
*/
void load_addons();
- /**
- * Write AddonManager configuration to Lisp
- */
- void write(Writer& writer);
-
- /**
- * Read AddonManager configuration from Lisp
- */
- void read(const Reader& lisp);
-
private:
std::vector<Addon*> addons;
- std::vector<std::string> ignored_addon_filenames;
+ std::vector<std::string>& ignored_addon_filenames;
};
#endif
record_demo(),
locale(),
keyboard_config(),
- joystick_config()
+ joystick_config(),
+ disabled_addon_filenames()
{
}
}
const lisp::Lisp* config_addons_lisp = config_lisp->get_lisp("addons");
- if (config_addons_lisp && AddonManager::current())
+ if (config_addons_lisp)
{
- AddonManager::current()->read(*config_addons_lisp);
+ config_addons_lisp->get("disabled-addons", disabled_addon_filenames);
}
}
}
writer.end_list("control");
- if (AddonManager::current())
- {
- writer.start_list("addons");
- AddonManager::current()->write(writer);
- writer.end_list("addons");
- }
+ writer.start_list("addons");
+ writer.write("disabled-addons", disabled_addon_filenames);
+ writer.end_list("addons");
writer.end_list("supertux-config");
}
KeyboardConfig keyboard_config;
JoystickConfig joystick_config;
+
+ std::vector<std::string> disabled_addon_filenames;
};
#endif
Resources resources;
timelog("addons");
- AddonManager addon_manager;
+ AddonManager addon_manager(g_config->disabled_addon_filenames);
addon_manager.load_addons();
timelog(0);
// sort list
std::sort(m_addons.begin(), m_addons.end(), generate_addons_menu_sorter);
-
add_label(_("Add-ons"));
add_hl();
kind = _("Level");
}
-
if(!addon.author.empty())
{
text = str(boost::format(_("%s \"%s\" by \"%s\""))