Files
MagicSetEditor2/src/data/statistics.hpp
T
GenevensiS 436c437189 add compiler directives
add compiler directives
2025-12-30 01:18:04 +01:00

75 lines
3.6 KiB
C++

//+----------------------------------------------------------------------------+
//| Description: Magic Set Editor - Program to make card games |
//| Copyright: (C) Twan van Laarhoven and the other MSE developers |
//| License: GNU General Public License 2 or later (see file COPYING) |
//+----------------------------------------------------------------------------+
#pragma once
// ----------------------------------------------------------------------------- : Includes
#include <util/prec.hpp>
#include <util/reflect.hpp>
#include <data/graph_type.hpp>
#include <data/localized_string.hpp>
#include <script/scriptable.hpp>
class Field;
DECLARE_POINTER_TYPE(StatsDimension);
DECLARE_POINTER_TYPE(StatsCategory);
// ----------------------------------------------------------------------------- : Statistics dimension
/// A dimension that can be plotted as an axis in a graph
/** Dimensions can be generated automatically based on card fields */
class StatsDimension : public IntrusivePtrBase<StatsDimension> {
public:
StatsDimension();
StatsDimension(const Field&);
const bool automatic; ///< Based on a card field?
String name; ///< Name of this dimension
LocalizedString description; ///< Description, used in status bar
int position_hint; ///< Hint for the ordering
String icon_filename; ///< Icon for lists
String dark_icon_filename; ///< Icon for lists, if a variant for dark mode is needed
Bitmap icon; ///< The loaded icon (optional of course)
OptionalScript script; ///< Script that determines the value(s), ran on each card
OptionalScript global_script; ///< Script that determines the value(s), ran only once at the start
bool numeric; ///< Are the values numeric? If so, they require special sorting
double bin_size; ///< Bin adjecent numbers?
bool show_empty; ///< Should "" be shown?
bool split_list; ///< Split values into multiple ones separated by commas
map<String,Color> colors; ///< Colors for the categories
vector<String> groups; ///< Order of the items
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : Statistics category
/// A category for statistics
/** Can be generated automatically based on a dimension */
class StatsCategory : public IntrusivePtrBase<StatsCategory> {
public:
StatsCategory();
StatsCategory(const StatsDimensionP&);
const bool automatic; ///< Automatically generated?
String name; ///< Name/label
LocalizedString description; ///< Description, used in status bar
int position_hint; ///< Hint for the ordering
String icon_filename; ///< Icon for lists
String dark_icon_filename; ///< Icon for lists when a variant for dark mode is needed
Bitmap icon; ///< The loaded icon (optional of course)
vector<String> dimension_names; ///< Names of the dimensions to use
vector<StatsDimensionP> dimensions; ///< Actual dimensions
GraphType type; ///< Type of graph to use
/// Initialize dimensions from dimension_names
void find_dimensions(const vector<StatsDimensionP>& available);
DECLARE_REFLECTION();
};