Enabled addons update interface.

Now I'm really tied to finish it before tagging.
This commit is contained in:
Ignacio R. Morelle 2008-08-18 21:31:45 +00:00
parent 6157979cac
commit c45fbb447b
3 changed files with 14 additions and 12 deletions

View File

@ -729,7 +729,7 @@ namespace {
}
}
} catch(version_info::not_sane_exception const&) {
ERR_CFG << "local add-on '" << name << "' has invalid version string '" << version << "', skipping from updates check...\n";
ERR_CFG << "local add-on '" << name << "' has invalid version info, skipping from updates check...\n";
continue;
}
}
@ -1195,11 +1195,11 @@ void manage_addons(game_display& disp)
svr_dialog.set_textbox(_("Server: "), default_host);
// not ready for production yet
#if 0
svr_dialog.add_button(new gui::dialog_button(disp.video(), _("Update add-ons"),
gui::button::TYPE_PRESS, addon_update),
gui::dialog::BUTTON_EXTRA_LEFT);
#endif
svr_dialog.add_button(new gui::dialog_button(disp.video(), _("Uninstall add-ons"),
gui::button::TYPE_PRESS, addon_uninstall),
gui::dialog::BUTTON_EXTRA);
@ -1272,11 +1272,6 @@ void refresh_addon_version_info_cache(void)
const version_info& get_addon_version_info(const std::string& addon)
{
static const version_info nil(0,0,0,false);
std::map< std::string, version_info >::iterator ret = version_info_cache.find(addon);
if (ret != version_info_cache.end())
return ret->second;
else
return nil;
std::map< std::string, version_info >::iterator entry = version_info_cache.find(addon);
return entry != version_info_cache.end() ? entry->second : nil;
}

View File

@ -2160,6 +2160,9 @@ static int play_game(int argc, char** argv)
return 0;
}
loadscreen::global_loadscreen->increment_progress(0, _("Searching for installed add-ons."));
refresh_addon_version_info_cache();
#if defined(_X11) && !defined(__APPLE__)
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
#endif

View File

@ -21,6 +21,8 @@
#include <sstream>
#include <stdexcept>
#include <iostream>
version_info::version_info(const version_info& o)
: nums_ (o.nums_),
special_ (o.special_),
@ -46,7 +48,7 @@ version_info::version_info(unsigned int major, unsigned int minor, unsigned int
version_info::version_info(const std::string& str)
: nums_(3,0), sane_(true)
{
const std::vector<std::string>& string_parts = utils::split(str,'.');
const std::vector<std::string> string_parts = utils::split(str,'.');
// first two components are required to be valid numbers, though
// only first component's existence is checked at all
const size_t parts = string_parts.size();
@ -95,7 +97,7 @@ void version_info::init_special_version(const std::string& full_component, std::
const char& c = full_component[sep_pos];
if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
special_separator_ = '\0';
special_ = c;
special_ = full_component.substr(sep_pos);
} else {
special_separator_ = c;
if(sep_pos != full_component.size() - 1) {
@ -207,6 +209,7 @@ bool operator!=(const version_info& l, const version_info& r)
bool operator<(const version_info& l, const version_info& r)
{
std::cerr << "compare: " << l.str() << " < " << r.str() << '\n';
std::less<unsigned int> o;
return version_info_comparison_internal(l, r, o) &&
((l.special_version().empty() && !r.special_version().empty()) ||
@ -215,6 +218,7 @@ bool operator<(const version_info& l, const version_info& r)
bool operator>(const version_info& l, const version_info& r)
{
std::cerr << "compare: " << l.str() << " > " << r.str() << '\n';
std::greater<unsigned int> o;
return version_info_comparison_internal(l, r, o) &&
((r.special_version().empty() && !l.special_version().empty()) ||