diff --git a/src/data/export_template.cpp b/src/data/export_template.cpp index 3ba929a3..f38ac9ed 100644 --- a/src/data/export_template.cpp +++ b/src/data/export_template.cpp @@ -20,6 +20,15 @@ ExportTemplate::ExportTemplate() String ExportTemplate::typeNameStatic() { return _("export-template"); } String ExportTemplate::typeName() const { return _("export-template"); } +void ExportTemplate::validate(Version) { + if (!game) { + throw Error(_ERROR_("no game specified for export template")); + } + // an export template depends on the game it is made for + requireDependency(game.get()); +} + + IMPLEMENT_REFLECTION(ExportTemplate) { REFLECT_BASE(Packaged); REFLECT(game); diff --git a/src/data/export_template.hpp b/src/data/export_template.hpp index e4f15efd..f44a57a3 100644 --- a/src/data/export_template.hpp +++ b/src/data/export_template.hpp @@ -35,6 +35,7 @@ class ExportTemplate : public Packaged { static String typeNameStatic(); virtual String typeName() const; + virtual void validate(Version = app_version); private: DECLARE_REFLECTION(); }; diff --git a/src/data/stylesheet.cpp b/src/data/stylesheet.cpp index 968642fd..1c0380c4 100644 --- a/src/data/stylesheet.cpp +++ b/src/data/stylesheet.cpp @@ -63,6 +63,15 @@ String StyleSheet::stylesheetName() const { String StyleSheet::typeNameStatic() { return _("style"); } String StyleSheet::typeName() const { return _("style"); } +void StyleSheet::validate(Version) { + if (!game) { + throw Error(_ERROR_("no game specified for stylesheet")); + } + // a stylsheet depends on the game it is made for + requireDependency(game.get()); +} + + StyleP StyleSheet::styleFor(const FieldP& field) { if (card_style.containsKey(field)) { return card_style[field]; diff --git a/src/data/stylesheet.hpp b/src/data/stylesheet.hpp index e19f2e48..ff328137 100644 --- a/src/data/stylesheet.hpp +++ b/src/data/stylesheet.hpp @@ -64,6 +64,8 @@ class StyleSheet : public Packaged { static String typeNameStatic(); virtual String typeName() const; + /// Validate the stylesheet + virtual void validate(Version = app_version); protected: