mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Add to_json and from_json script functions
This commit is contained in:
@@ -40,7 +40,6 @@ Field::~Field() {}
|
||||
|
||||
void Field::initDependencies(Context& ctx, const Dependency& dep) const {
|
||||
sort_script.initDependencies(ctx, dep);
|
||||
import_script.initDependencies(ctx, dep);
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION(Field) {
|
||||
|
||||
@@ -62,9 +62,9 @@ wxDataFormat CardsDataObject::format = _("application/x-mse-cards");
|
||||
|
||||
CardsDataObject::CardsDataObject(const SetP& set, const vector<CardP>& cards) {
|
||||
// set the stylesheet, so when deserializing we know whos style options we are reading
|
||||
bool* has_styling = new bool[cards.size()];
|
||||
vector<bool> has_styling;
|
||||
for (size_t i = 0 ; i < cards.size() ; ++i) {
|
||||
has_styling[i] = cards[i]->has_styling && !cards[i]->stylesheet;
|
||||
has_styling.push_back(cards[i]->has_styling && !cards[i]->stylesheet);
|
||||
if (has_styling[i]) {
|
||||
cards[i]->stylesheet = set->stylesheet;
|
||||
}
|
||||
@@ -78,7 +78,6 @@ CardsDataObject::CardsDataObject(const SetP& set, const vector<CardP>& cards) {
|
||||
}
|
||||
}
|
||||
SetFormat(format);
|
||||
delete [] has_styling;
|
||||
}
|
||||
|
||||
CardsDataObject::CardsDataObject() {
|
||||
|
||||
@@ -91,11 +91,11 @@ public:
|
||||
Keyword() : fixed(false), valid(false) {}
|
||||
|
||||
String keyword; ///< The keyword, only for human use
|
||||
String rules; ///< Rules/explanation
|
||||
String match; ///< String to match, <atom-param> tags are used for parameters
|
||||
vector<KeywordParamP> parameters; ///< The types of parameters
|
||||
StringScript reminder; ///< Reminder text of the keyword
|
||||
String mode; ///< Mode of use, can be used by scripts (only gives the name)
|
||||
String rules; ///< Rules/explanation
|
||||
String match; ///< String to match, <atom-param> tags are used for parameters
|
||||
vector<KeywordParamP> parameters; ///< The types of parameters
|
||||
StringScript reminder; ///< Reminder text of the keyword
|
||||
String mode; ///< Mode of use, can be used by scripts (only gives the name)
|
||||
/// Regular expression to match and split parameters, automatically generated.
|
||||
/** The regex has exactly 2 * parameters.size() + 1 captures (excluding the entire match, caputure 0),
|
||||
* captures 1,3,... capture the plain text of the match string
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ bool PackType::update(Context& ctx) {
|
||||
|
||||
bool PackItem::update(Context& ctx) {
|
||||
return amount.update(ctx)
|
||||
| weight.update(ctx);
|
||||
|| weight.update(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ public:
|
||||
/// The values on the fields of the set
|
||||
/** The indices should correspond to the set_fields in the Game */
|
||||
IndexMap<FieldP, ValueP> data;
|
||||
/// Extra values for specitic stylesheets, indexed by stylesheet name
|
||||
/// Extra values for specific stylesheets, indexed by stylesheet name
|
||||
DelayedIndexMaps<FieldP,ValueP> styling_data;
|
||||
vector<CardP> cards; ///< The cards in the set
|
||||
vector<KeywordP> keywords; ///< Additional keywords used in this set
|
||||
|
||||
Reference in New Issue
Block a user