Added some new update code (YET TO BE TESTED) and some fixes to the VS

templates.
Still looking to find one source of a reference to 
"futsymbol_artifact.png" (case-sensitive)


git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@757 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
coppro
2007-09-25 23:28:12 +00:00
parent 3ea0a4abd7
commit 30e18663f6
13 changed files with 88 additions and 24 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ card style:
visible:
script: styling.watermarkings
render style: image
include file: vs-common.mse-include/watermarks
include file: /vs-common.mse-include/watermarks
z index: 4
############################# Attack/defence
+1 -1
View File
@@ -345,7 +345,7 @@ card style:
visible:
script: styling.watermarkings
render style: image
include file: vs-common.mse-include/watermarks
include file: /vs-common.mse-include/watermarks
z index: 4
############################# Atack/defence
+1 -1
View File
@@ -345,7 +345,7 @@ card style:
visible:
script: styling.watermarkings
render style: image
include file: vs-common.mse-include/watermarks
include file: /vs-common.mse-include/watermarks
z index: 4
############################# Atack/defence
+1 -1
View File
@@ -364,7 +364,7 @@ card style:
visible:
script: styling.watermarkings
render style: image
include file: vs-common.mse-include/watermarks
include file: /vs-common.mse-include/watermarks
z index: 4
############################# Atack/defence
+3 -3
View File
@@ -342,7 +342,7 @@ card style:
visible:
script: styling.watermarkings
render style: image
include file: vs-common.mse-include/watermarks
include file: /vs-common.mse-include/watermarks
z index: 4
@@ -447,7 +447,7 @@ extra card field:
name: affiliation
editable: false
initial: none
include file: vs-common.mse-include/watermark-names
include file: /vs-common.mse-include/watermark-names
extra card style:
playarea:
@@ -505,4 +505,4 @@ extra card style:
z index: 5
alignment: middle right
render style: image
include file: vs-common.mse-include/affiliations
include file: /vs-common.mse-include/affiliations

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

+1 -1
View File
@@ -367,7 +367,7 @@ card style:
visible:
script: styling.watermarkings
render style: image
include file: vs-common.mse-include/watermarks
include file: /vs-common.mse-include/watermarks
z index: 4
+5 -2
View File
@@ -4,6 +4,9 @@ short name: VS
icon: card-back.png
version: 2007-09-23
position hint: 3
depends on:
package: vs-common.mse-include
version: 2007-09-23
############################################################## Functions & filters
# General functions
@@ -606,7 +609,7 @@ card field:
card field:
type: choice
name: watermark
include file: vs-common.mse-include/watermark-names
include file: /vs-common.mse-include/watermark-names
editable: false
description: The Watermark for this set.
@@ -828,4 +831,4 @@ keyword:
keyword: Substitute
match: Substitute
mode: real
reminder: Reveal this card -> You may remove from the game a ready character you control with cost greater than or equal to the cost of this card. If you do, put this card into play. Use only if this card is in your hand and only during your recruit step."
reminder: Reveal this card -> You may remove from the game a ready character you control with cost greater than or equal to the cost of this card. If you do, put this card into play. Use only if this card is in your hand and only during your recruit step."
+9 -7
View File
@@ -62,7 +62,7 @@ struct dependency_check : public unary_function<bool, PackagedP> {
PackageDependencyP dep;
};
void Installer::install(bool local) {
void Installer::install(bool local, bool check_dependencies) {
// Destination directory
String install_dir = local ? ::packages.getLocalDataDir() : ::packages.getGlobalDataDir();
if (!wxDirExists(install_dir)) {
@@ -92,12 +92,14 @@ void Installer::install(bool local) {
new_packages.push_back(pack);
}
// Check dependencies for each and every package.
FOR_EACH(p, new_packages) {
FOR_EACH(d, p->dependencies) {
if (find_if(new_packages.begin(), new_packages.end(), dependency_check(d)) == new_packages.end() &&
!::packages.checkDependency(*d, false)) {
throw PackageError(_("Unmet dependency for package ") + p->relativeFilename() + _(": ") + d->package + _(", version ") + d->version.toString() + _(" or higher."));
if (check_dependencies) {
// Check dependencies for each and every package.
FOR_EACH(p, new_packages) {
FOR_EACH(d, p->dependencies) {
if (find_if(new_packages.begin(), new_packages.end(), dependency_check(d)) == new_packages.end() &&
!::packages.checkDependency(*d, false)) {
throw PackageError(_("Unmet dependency for package ") + p->relativeFilename() + _(": ") + d->package + _(", version ") + d->version.toString() + _(" or higher."));
}
}
}
}
+1 -1
View File
@@ -37,7 +37,7 @@ class Installer : public Packaged {
/// Load an installer from a file, and run it
static void installFrom(const String& filename, bool message_on_success, bool local);
/// Install all the packages
void install(bool local);
void install(bool local, bool check_dependencies = true);
/// Install a specific package
void install(const String& package);
+59 -5
View File
@@ -8,6 +8,7 @@
#include <gui/update_checker.hpp>
#include <data/settings.hpp>
#include <data/installer.hpp>
#include <util/io/package_manager.hpp>
#include <util/version.hpp>
#include <util/window_id.hpp>
@@ -17,8 +18,11 @@
#include <wx/url.h>
#include <wx/html/htmlwin.h>
#include <wx/vlbox.h>
#include <wx/zipstrm.h>
#include <list>
DECLARE_POINTER_TYPE(PackageVersionData);
DECLARE_POINTER_TYPE(Installer);
DECLARE_POINTER_TYPE(VersionData);
DECLARE_TYPEOF_COLLECTION(PackageVersionDataP);
@@ -358,6 +362,10 @@ UpdatesWindow::UpdatesWindow()
SetSizer(v);
}
UpdatesWindow::~UpdatesWindow() {
(new WelcomeWindow)->Show();
}
void UpdatesWindow::onUpdateCheckFinished(wxCommandEvent&) {
setDefaultPackageStatus();
}
@@ -405,9 +413,53 @@ void UpdatesWindow::onActionChange(wxCommandEvent& ev) {
}
void UpdatesWindow::onApplyChanges(wxCommandEvent& ev) {
list<PackageVersionDataP> to_install, to_remove;
FOR_EACH(pack, update_version_data->packages) {
PackageAction action = package_data[pack].second;
switch (package_data[pack].second) {
case ACTION_INSTALL:
to_install.push_back(pack);
break;
case ACTION_UPGRADE:
to_install.push_back(pack);
case ACTION_UNINSTALL:
to_remove.push_back(pack);
default:;
}
}
FOR_EACH(pack, to_remove) {
wxFileName filename (packages.openAny(pack->name, true)->absoluteFilename());
if (filename.DirExists()) {
// TODO: Recursive removal of directory.
} else {
if (!wxRemoveFile(filename.GetFullPath()))
handle_error(_("Cannot delete ") + filename.GetFullPath() + _(" to remove package ") + pack->name + _(". "
"Other packages may have been removed, including packages that this on is dependent on. Please remove manually."));
}
}
FOR_EACH(pack, to_install) {
wxURL url(pack->url);
wxInputStream* is = url.GetInputStream();
if (!is) {
handle_error(_("Cannot fetch file ") + pack->url + _(" to install package ") + pack->name + _(". "
"Other packages may have been installed, including packages that depend on this one. "
"Please remove those packages manually or install this one manually."));
}
wxZipInputStream zis(is);
InstallerP inst(new Installer);
inst->openZipStream(&zis);
inst->install(isInstallLocal(settings.install_type), false);
delete is;
}
setDefaultPackageStatus();
updateButtons(package_list->GetSelection());
package_list->Refresh();
packages.clearPackageCache();
}
void UpdatesWindow::updateButtons(int id) {
@@ -446,9 +498,9 @@ void UpdatesWindow::setDefaultPackageStatus() {
FOR_EACH(p, update_version_data->packages) {
PackagedP pack;
try { pack = packages.openAny(p->name, true); }
catch (const PackageError&) { } // We couldn't open a package... wonder why?
catch (PackageNotFoundError&) { } // We couldn't open a package... no cause for alarm
if (!pack) {
if (!pack || !(wxFileExists(pack->absoluteFilename()) || wxDirExists(pack->absoluteFilename()))) {
// not installed
if (p->app_version > file_version) {
package_data[p] = PackageData(STATUS_NOT_INSTALLED, ACTION_NEW_MSE);
@@ -512,7 +564,7 @@ void UpdatesWindow::RemovePackageDependencies (PackageVersionDataP pack) {
if (status != STATUS_NOT_INSTALLED)
action = ACTION_UNINSTALL;
else // status == STATUS_NOT_INSTALLED
action = p->app_version > file_version ? ACTION_NOTHING : ACTION_NEW_MSE;
action = p->app_version > file_version ? ACTION_NEW_MSE : ACTION_NOTHING;
break;
}
}
@@ -545,6 +597,8 @@ void UpdatesWindow::DowngradePackageDependencies (PackageVersionDataP pack) {
// TODO: Decide what to do if a dependency can't be met.
// It shouldn't happen with a decently maintained updates list.
// But it could, and we need to decide what to do in this situation.
// Ideally, some sort of error should occur, such that we don't have packages
// with unmet dependencies.
}
FOR_EACH(p, update_version_data->packages) {
@@ -558,7 +612,7 @@ void UpdatesWindow::DowngradePackageDependencies (PackageVersionDataP pack) {
if (status != STATUS_NOT_INSTALLED)
action = ACTION_UNINSTALL;
else // status == STATUS_NOT_INSTALLED
action = p->app_version > file_version ? ACTION_NOTHING : ACTION_NEW_MSE;
action = p->app_version > file_version ? ACTION_NEW_MSE : ACTION_NOTHING;
break;
}
}
+1 -1
View File
@@ -40,7 +40,7 @@ DECLARE_POINTER_TYPE(PackageVersionData);
class UpdatesWindow : public Frame {
public:
UpdatesWindow();
~UpdatesWindow() { (new WelcomeWindow)->Show(); }
~UpdatesWindow();
void DrawTitles(wxPaintEvent&);
+5
View File
@@ -78,6 +78,11 @@ class PackageManager {
/// Check if the given dependency is currently installed
bool checkDependency(const PackageDependency& dep, bool report_errors = true);
/// Clear that cache of opened packages
/** Used by the update manager
*/
inline void clearPackageCache() { loaded_packages.clear(); }
inline String getGlobalDataDir() const { return global_data_directory; }
inline String getLocalDataDir() const { return local_data_directory; }