Commit b3f79483 authored by twanvl's avatar twanvl

stylesheet and export template have a dependency on the game

parent 18110496
...@@ -20,6 +20,15 @@ ExportTemplate::ExportTemplate() ...@@ -20,6 +20,15 @@ ExportTemplate::ExportTemplate()
String ExportTemplate::typeNameStatic() { return _("export-template"); } String ExportTemplate::typeNameStatic() { return _("export-template"); }
String ExportTemplate::typeName() const { 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) { IMPLEMENT_REFLECTION(ExportTemplate) {
REFLECT_BASE(Packaged); REFLECT_BASE(Packaged);
REFLECT(game); REFLECT(game);
......
...@@ -35,6 +35,7 @@ class ExportTemplate : public Packaged { ...@@ -35,6 +35,7 @@ class ExportTemplate : public Packaged {
static String typeNameStatic(); static String typeNameStatic();
virtual String typeName() const; virtual String typeName() const;
virtual void validate(Version = app_version);
private: private:
DECLARE_REFLECTION(); DECLARE_REFLECTION();
}; };
......
...@@ -63,6 +63,15 @@ String StyleSheet::stylesheetName() const { ...@@ -63,6 +63,15 @@ String StyleSheet::stylesheetName() const {
String StyleSheet::typeNameStatic() { return _("style"); } String StyleSheet::typeNameStatic() { return _("style"); }
String StyleSheet::typeName() const { 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) { StyleP StyleSheet::styleFor(const FieldP& field) {
if (card_style.containsKey(field)) { if (card_style.containsKey(field)) {
return card_style[field]; return card_style[field];
......
...@@ -64,6 +64,8 @@ class StyleSheet : public Packaged { ...@@ -64,6 +64,8 @@ class StyleSheet : public Packaged {
static String typeNameStatic(); static String typeNameStatic();
virtual String typeName() const; virtual String typeName() const;
/// Validate the stylesheet
virtual void validate(Version = app_version);
protected: protected:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment