mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 13:06:59 -04:00
mostly backwards compatibility with old pack system, uses boost tribool
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1311 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -54,7 +54,11 @@ IMPLEMENT_REFLECTION(Game) {
|
||||
REFLECT_NO_SCRIPT(card_list_color_script);
|
||||
REFLECT_NO_SCRIPT(statistics_dimensions);
|
||||
REFLECT_NO_SCRIPT(statistics_categories);
|
||||
#if USE_NEW_PACK_SYSTEM
|
||||
REFLECT_ALIAS(307, "pack item", "pack type");
|
||||
#else
|
||||
REFLECT_NO_SCRIPT(pack_items);
|
||||
#endif
|
||||
REFLECT_NO_SCRIPT(pack_types);
|
||||
REFLECT_NO_SCRIPT(keyword_match_script);
|
||||
REFLECT(has_keywords);
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <script/scriptable.hpp>
|
||||
#include <script/dependency.hpp>
|
||||
#include <util/dynamic_arg.hpp>
|
||||
#include <data/pack.hpp> // for USE_NEW_PACK_SYSTEM
|
||||
|
||||
DECLARE_POINTER_TYPE(Field);
|
||||
DECLARE_POINTER_TYPE(Style);
|
||||
@@ -46,7 +47,9 @@ class Game : public Packaged {
|
||||
OptionalScript card_list_color_script; ///< Script that determines the color of items in the card list
|
||||
vector<StatsDimensionP> statistics_dimensions; ///< (Additional) statistics dimensions
|
||||
vector<StatsCategoryP> statistics_categories; ///< (Additional) statistics categories
|
||||
#if !USE_NEW_PACK_SYSTEM
|
||||
vector<PackItemP> pack_items; ///< Types of cards in packs
|
||||
#endif
|
||||
vector<PackTypeP> pack_types; ///< Types of random card packs to generate
|
||||
vector<WordListP> word_lists; ///< Word lists for editing with a drop down list
|
||||
vector<AddCardsScriptP> add_cards_scripts; ///< Scripts for adding multiple cards to the set
|
||||
|
||||
+6
-2
@@ -187,9 +187,13 @@ IMPLEMENT_REFLECTION(PackType) {
|
||||
REFLECT(items);
|
||||
REFLECT_IF_READING {
|
||||
if (select == SELECT_AUTO) {
|
||||
if (filter) select = SELECT_NO_REPLACE;
|
||||
if (filter) select = SELECT_NO_REPLACE;
|
||||
else if (!items.empty()) select = SELECT_ALL;
|
||||
}
|
||||
if (indeterminate(selectable)) {
|
||||
if (filter) selectable = false;
|
||||
else if (!items.empty()) selectable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +206,7 @@ IMPLEMENT_REFLECTION(PackItem) {
|
||||
|
||||
PackType::PackType()
|
||||
: enabled(true)
|
||||
, selectable(true)
|
||||
, selectable(indeterminate)
|
||||
, summary(true)
|
||||
, select(SELECT_AUTO)
|
||||
{}
|
||||
|
||||
+2
-1
@@ -13,6 +13,7 @@
|
||||
#include <util/reflect.hpp>
|
||||
#include <script/scriptable.hpp>
|
||||
#include <boost/random/mersenne_twister.hpp>
|
||||
#include <boost/logic/tribool.hpp>
|
||||
|
||||
#define USE_NEW_PACK_SYSTEM 1
|
||||
|
||||
@@ -135,7 +136,7 @@ class PackType : public IntrusivePtrBase<PackType> {
|
||||
|
||||
String name; ///< Name of this pack
|
||||
Scriptable<bool> enabled; ///< Is this pack enabled?
|
||||
bool selectable; ///< Is this pack listed in the UI?
|
||||
tribool selectable; ///< Is this pack listed in the UI?
|
||||
bool summary; ///< Should the total be listed for this type?
|
||||
PackSelectType select; ///< What cards/items to select
|
||||
OptionalScript filter; ///< Filter to select this type of cards
|
||||
|
||||
@@ -268,7 +268,7 @@ void RandomPackPanel::onChangeSet() {
|
||||
|
||||
// add pack controls
|
||||
FOR_EACH(pack, set->game->pack_types) {
|
||||
#if NEW_PACK_SYSTEM
|
||||
#if USE_NEW_PACK_SYSTEM
|
||||
if (pack->selectable) {
|
||||
#endif
|
||||
PackItem i;
|
||||
@@ -278,7 +278,7 @@ void RandomPackPanel::onChangeSet() {
|
||||
packsSizer->Add(i.label, 0, wxALIGN_CENTER_VERTICAL);
|
||||
packsSizer->Add(i.value, 0, wxEXPAND | wxALIGN_CENTER);
|
||||
packs.push_back(i);
|
||||
#if NEW_PACK_SYSTEM
|
||||
#if USE_NEW_PACK_SYSTEM
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <util/vector2d.hpp>
|
||||
#include <script/script.hpp>
|
||||
#include <script/to_value.hpp>
|
||||
#include <boost/logic/tribool.hpp>
|
||||
|
||||
// ---------------------------------------------------------------------------- : GetDefaultMember
|
||||
|
||||
@@ -21,6 +22,7 @@ template <> void GetDefaultMember::handle(const int& v) { value = to_sc
|
||||
template <> void GetDefaultMember::handle(const unsigned int& v) { value = to_script((int)v); }
|
||||
template <> void GetDefaultMember::handle(const double& v) { value = to_script(v); }
|
||||
template <> void GetDefaultMember::handle(const bool& v) { value = to_script(v); }
|
||||
template <> void GetDefaultMember::handle(const tribool& v) { value = to_script((bool)v); }
|
||||
template <> void GetDefaultMember::handle(const Vector2D& v) { value = to_script(String::Format(_("(%.10lf,%.10lf)"), v.x, v.y)); }
|
||||
template <> void GetDefaultMember::handle(const Color& v) { value = to_script(v); }
|
||||
void GetDefaultMember::handle(const ScriptValueP& v) { value = v; }
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <util/vector2d.hpp>
|
||||
#include <util/error.hpp>
|
||||
#include <util/io/package_manager.hpp>
|
||||
#include <boost/logic/tribool.hpp>
|
||||
#undef small
|
||||
|
||||
typedef void (*ReaderPragmaHandler)(String&);
|
||||
@@ -366,6 +367,10 @@ template <> void Reader::handle(bool& b) {
|
||||
const String& v = getValue();
|
||||
b = (v==_("true") || v==_("1") || v==_("yes"));
|
||||
}
|
||||
template <> void Reader::handle(tribool& b) {
|
||||
const String& v = getValue();
|
||||
b = (v==_("true") || v==_("1") || v==_("yes"));
|
||||
}
|
||||
// ----------------------------------------------------------------------------- : Handling less basic util types
|
||||
|
||||
template <> void Reader::handle(Vector2D& vec) {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <util/error.hpp>
|
||||
#include <util/version.hpp>
|
||||
#include <util/io/package.hpp>
|
||||
#include <boost/logic/tribool.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : Writer
|
||||
|
||||
@@ -104,6 +105,11 @@ template <> void Writer::handle(const double& value) {
|
||||
template <> void Writer::handle(const bool& value) {
|
||||
handle(value ? _("true") : _("false"));
|
||||
}
|
||||
template <> void Writer::handle(const tribool& value) {
|
||||
if (!indeterminate(value)) {
|
||||
handle(value ? _("true") : _("false"));
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------- : Handling less basic util types
|
||||
|
||||
|
||||
Reference in New Issue
Block a user