diff --git a/src/data/set.cpp b/src/data/set.cpp index f85efda0..ce67cea5 100644 --- a/src/data/set.cpp +++ b/src/data/set.cpp @@ -129,7 +129,21 @@ ScriptValueP make_iterator(const Set& set) { } void mark_dependency_member(Set* value, const String& name, const Dependency& dep) { - // TODO + // is it the card list? + if (name == _("cards")) { + value->game->dependent_scripts_cards.push_back(dep); + return; + } + // is it the keywords? + if (name == _("keywords")) { + value->game->dependent_scripts_keywords.push_back(dep); + return; + } + // is it in the set data? + IndexMap::const_iterator it = value->data.find(name); + if (it != value->data.end()) { + (*it)->fieldP->dependent_scripts.push_back(dep); + } } void mark_dependency_member(const SetP& value, const String& name, const Dependency& dep) { mark_dependency_member(value.get(), name, dep); @@ -157,6 +171,9 @@ int Set::positionOfCard(const CardP& card, const ScriptValueP& order_by) { } return order->find(card); } +void Set::clearOrderCache() { + order_cache.clear(); +} // ----------------------------------------------------------------------------- : Styling diff --git a/src/data/set.hpp b/src/data/set.hpp index f162cbc5..cc3a6b98 100644 --- a/src/data/set.hpp +++ b/src/data/set.hpp @@ -93,6 +93,8 @@ class Set : public Packaged { /// Find the position of a card in this set, when the card list is sorted using the given cirterium int positionOfCard(const CardP& card, const ScriptValueP& order_by); + /// Clear the order_cache used by positionOfCard + void clearOrderCache(); protected: virtual String typeName() const; diff --git a/src/script/dependency.hpp b/src/script/dependency.hpp index 09de93e6..79ce6ef6 100644 --- a/src/script/dependency.hpp +++ b/src/script/dependency.hpp @@ -33,6 +33,11 @@ class Dependency { DependencyType type : 5; ///< Type of the dependent script size_t index : 27; ///< index into an IndexMap void* data; ///< Extra pointer data + + /// This dependency, but dependent on all cards instead of just one + inline Dependency makeCardIndependend() const { + return Dependency(type == DEP_CARD_FIELD ? DEP_CARDS_FIELD : type, index, data); + } }; // ----------------------------------------------------------------------------- : EOF diff --git a/src/script/functions.cpp b/src/script/functions.cpp index 70b2e42e..6f757a2f 100644 --- a/src/script/functions.cpp +++ b/src/script/functions.cpp @@ -8,6 +8,7 @@ #include