Changed Pack structures

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1021 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-07-11 17:07:51 +00:00
parent f235eeb100
commit 8881eef42d
7 changed files with 170 additions and 58 deletions
+1
View File
@@ -53,6 +53,7 @@ IMPLEMENT_REFLECTION(Game) {
REFLECT_NO_SCRIPT(card_list_color_script);
REFLECT_NO_SCRIPT(statistics_dimensions);
REFLECT_NO_SCRIPT(statistics_categories);
REFLECT_NO_SCRIPT(pack_items);
REFLECT_NO_SCRIPT(pack_types);
REFLECT_NO_SCRIPT(keyword_match_script);
REFLECT(has_keywords);
+2
View File
@@ -20,6 +20,7 @@ DECLARE_POINTER_TYPE(Style);
DECLARE_POINTER_TYPE(Game);
DECLARE_POINTER_TYPE(StatsDimension);
DECLARE_POINTER_TYPE(StatsCategory);
DECLARE_POINTER_TYPE(PackItem);
DECLARE_POINTER_TYPE(PackType);
DECLARE_POINTER_TYPE(KeywordParam);
DECLARE_POINTER_TYPE(KeywordMode);
@@ -44,6 +45,7 @@ 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
vector<PackItemP> pack_items; ///< Types of cards in packs
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<AutoReplaceP> auto_replaces; ///< Things to autoreplace in textboxes
+31 -3
View File
@@ -18,13 +18,41 @@ PackType::PackType()
IMPLEMENT_REFLECTION(PackType) {
REFLECT(name);
REFLECT(enabled);
REFLECT(card_types);
REFLECT(items);
}
// ----------------------------------------------------------------------------- : CardType
void PackType::generate(Set& set, vector<CardP>& out) const {
//%FOR_EACH(card_type, card_types) {
//% card_type->generate(set,out);
//%}
}
IMPLEMENT_REFLECTION(CardType) {
// ----------------------------------------------------------------------------- : PackItemRef
PackItemRef::PackItemRef()
: amount(1)
{}
IMPLEMENT_REFLECTION(PackItemRef) {
REFLECT(name);
REFLECT(amount);
}
bool PackItemRef::update(Context& ctx) {
return amount.update(ctx);
}
// ----------------------------------------------------------------------------- : PackItem
IMPLEMENT_REFLECTION(PackItem) {
REFLECT(name);
REFLECT(filter);
}
void PackItem::generate(Set& set, vector<CardP>& out) const {
//%Context& ctx = set.getContext();
//%amount.update(ctx);
//%FOR_EACH(card_type, card_types) {
//% card_type->generate(set,out);
//%}
}
+31 -9
View File
@@ -13,7 +13,7 @@
#include <util/reflect.hpp>
#include <script/scriptable.hpp>
DECLARE_POINTER_TYPE(CardType);
DECLARE_POINTER_TYPE(PackItemRef);
DECLARE_POINTER_TYPE(Card);
class Set;
@@ -24,25 +24,47 @@ class PackType : public IntrusivePtrBase<PackType> {
public:
PackType();
String name; ///< Name of this pack
vector<CardTypeP> card_types; ///< Cards in this pack
Scriptable<bool> enabled; ///< Is this pack enabled?
String name; ///< Name of this pack
Scriptable<bool> enabled; ///< Is this pack enabled?
vector<PackItemRefP> items; ///< Cards in this pack
/// Generate a random pack of cards
void generate(Set& set, vector<CardP>& out);
/// Generate a random pack of cards, add them to out
void generate(Set& set, vector<CardP>& out) const;
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : CardType
// ----------------------------------------------------------------------------- : PackItemRef
/// A card type description for playtesting
class CardType : public IntrusivePtrBase<CardType> {
class PackItemRef : public IntrusivePtrBase<PackItemRef> {
public:
PackItemRef();
String name; ///< Name of this type of cards
Scriptable<int> amount; ///< Number of cards of this type
/// Update scripts, returns true if there is a change
bool update(Context& ctx);
/// Generate random cards, add them to out
void generate(Set& set, vector<CardP>& out) const;
private:
DECLARE_REFLECTION();
};
// ----------------------------------------------------------------------------- : PackItem
/// A card type description for playtesting
class PackItem : public IntrusivePtrBase<PackItem> {
public:
String name; ///< Name of this type of cards
OptionalScript filter; ///< Filter to select this type of cards
/// Generate random cards, add them to out
void generate(Set& set, vector<CardP>& out) const;
private:
DECLARE_REFLECTION();
};