mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Cleaned up the reflection code a bit
* Renamed 'tag' variable to 'handler' * Removed addAlias stuff, instead check for matching names with if statements * Added after_reading function that is called by Reader after reading a complete object. This generalizes Packaged::validate, which is now also called via this mechanism. * Removed some backwards compatibility with <0.3.0 for templates
This commit is contained in:
+14
-14
@@ -38,24 +38,24 @@ IMPLEMENT_REFLECTION(PackType) {
|
||||
REFLECT(select);
|
||||
REFLECT(filter);
|
||||
REFLECT(items);
|
||||
REFLECT_IF_READING {
|
||||
if (select == SELECT_AUTO) {
|
||||
if (filter) select = SELECT_NO_REPLACE;
|
||||
else if (!items.empty()) select = SELECT_ALL;
|
||||
}
|
||||
if (indeterminate(summary)) {
|
||||
if (filter) summary = true;
|
||||
else if (!items.empty()) summary = false;
|
||||
}
|
||||
if (indeterminate(selectable)) {
|
||||
if (filter) selectable = false;
|
||||
else if (!items.empty()) selectable = true;
|
||||
}
|
||||
}
|
||||
void after_reading(PackType& pt, Version) {
|
||||
if (pt.select == SELECT_AUTO) {
|
||||
if (pt.filter) pt.select = SELECT_NO_REPLACE;
|
||||
else if (!pt.items.empty()) pt.select = SELECT_ALL;
|
||||
}
|
||||
if (indeterminate(pt.summary)) {
|
||||
if (pt.filter) pt.summary = true;
|
||||
else if (!pt.items.empty()) pt.summary = false;
|
||||
}
|
||||
if (indeterminate(pt.selectable)) {
|
||||
if (pt.filter) pt.selectable = false;
|
||||
else if (!pt.items.empty()) pt.selectable = true;
|
||||
}
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION(PackItem) {
|
||||
if (!tag.isComplex()) {
|
||||
REFLECT_IF_READING_SINGLE_VALUE {
|
||||
REFLECT_NAMELESS(name);
|
||||
} else {
|
||||
REFLECT(name);
|
||||
|
||||
Reference in New Issue
Block a user