diff --git a/src/data/action/set.cpp b/src/data/action/set.cpp index 583ff8c1..e2d6bf3b 100644 --- a/src/data/action/set.cpp +++ b/src/data/action/set.cpp @@ -14,6 +14,8 @@ #include DECLARE_TYPEOF_COLLECTION(IndexMap); +DECLARE_TYPEOF_COLLECTION(CardP); +DECLARE_TYPEOF_COLLECTION(int); // ----------------------------------------------------------------------------- : Add card @@ -95,12 +97,24 @@ String ChangeSetStyleAction::getName(bool to_undo) const { } void ChangeSetStyleAction::perform(bool to_undo) { if (!to_undo) { + // backup has_styling + has_styling.clear(); + FOR_EACH(card, set.cards) { + has_styling.push_back(card->has_styling); + if (!card->stylesheet) { + card->has_styling = false; // this card has custom style options for the default stylesheet + } + } stylesheet = set.stylesheet; set.stylesheet = card->stylesheet; card->stylesheet = StyleSheetP(); } else { card->stylesheet = set.stylesheet; set.stylesheet = stylesheet; + // restore has_styling + FOR_EACH_2(card, set.cards, has, has_styling) { + card->has_styling = has; + } } } diff --git a/src/data/action/set.hpp b/src/data/action/set.hpp index 4dfe49f2..1ee75d56 100644 --- a/src/data/action/set.hpp +++ b/src/data/action/set.hpp @@ -101,6 +101,7 @@ class ChangeSetStyleAction : public DisplayChangeAction { Set& set; ///< The affected set CardP card; ///< The card whos stylesheet is copied to the set StyleSheetP stylesheet; ///< The old stylesheet of the set + vector has_styling; ///< The old has_styling values of all cards (vector is evil) }; /// Changing the styling of a card to become custom/non-custom diff --git a/src/data/card.hpp b/src/data/card.hpp index 0aaf2042..61fb6116 100644 --- a/src/data/card.hpp +++ b/src/data/card.hpp @@ -41,7 +41,9 @@ class Card : public IntrusivePtrVirtualBase { /** Optional; if not set use the card style from the set */ StyleSheetP stylesheet; /// Alternative options to use for this card, for this card's stylesheet - /** Optional; if not set use the styling data from the set */ + /** Optional; if not set use the styling data from the set. + * If stylesheet is set then contains data for the this->stylesheet, otherwise for set->stylesheet + */ IndexMap styling_data; /// Is the styling_data set? bool has_styling;