mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
Keyword usage can now be used for statistics
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@517 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -147,6 +147,8 @@ void StatsPanel::onCommand(int id) {
|
||||
|
||||
// ----------------------------------------------------------------------------- : Filtering card list
|
||||
|
||||
bool chosen(const String& choice, const String& input);
|
||||
|
||||
class StatsFilter : public CardListFilter {
|
||||
public:
|
||||
StatsFilter(Set& set)
|
||||
@@ -155,7 +157,13 @@ class StatsFilter : public CardListFilter {
|
||||
virtual bool keep(const CardP& card) {
|
||||
Context& ctx = set.getContext(card);
|
||||
FOR_EACH(v, values) {
|
||||
if (v.first->script.invoke(ctx)->toString() != v.second) return false;
|
||||
StatsDimension& dim = *v.first;
|
||||
String value = dim.script.invoke(ctx)->toString();
|
||||
if (dim.split_list) {
|
||||
if (!chosen(v.second, value)) return false;
|
||||
} else {
|
||||
if (value != v.second) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -208,6 +216,12 @@ void StatsPanel::showCategory() {
|
||||
d.elements.push_back(e);
|
||||
}
|
||||
}
|
||||
// split lists
|
||||
size_t dim_id = 0;
|
||||
FOR_EACH(dim, cat.dimensions) {
|
||||
if (dim->split_list) d.splitList(dim_id);
|
||||
++dim_id;
|
||||
}
|
||||
graph->setLayout(cat.type);
|
||||
graph->setData(d);
|
||||
filterCards();
|
||||
|
||||
Reference in New Issue
Block a user