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:
twanvl
2009-01-09 00:49:14 +00:00
parent bce5761781
commit 432cdcd583
8 changed files with 30 additions and 5 deletions
+4
View File
@@ -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);
+3
View File
@@ -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
View File
@@ -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
View File
@@ -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