while it is still possible: renamed select:cyclic to select:equal.

Added "equal proportional" and "equal nonempty" for symmetry.
select:equal now takes weights into account.

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1342 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2009-01-11 01:36:17 +00:00
parent c8dd777bca
commit 8b9c2b4064
4 changed files with 190 additions and 107 deletions
+11 -3
View File
@@ -121,11 +121,13 @@ class PackGenerator;
enum PackSelectType
{ SELECT_AUTO
, SELECT_ALL
, SELECT_REPLACE
, SELECT_NO_REPLACE
, SELECT_CYCLIC
, SELECT_REPLACE
, SELECT_PROPORTIONAL
, SELECT_NONEMPTY
, SELECT_EQUAL
, SELECT_EQUAL_PROPORTIONAL
, SELECT_EQUAL_NONEMPTY
, SELECT_FIRST
};
@@ -200,17 +202,23 @@ class PackInstance : public IntrusivePtrBase<PackInstance> {
PackGenerator& parent;
int depth; //< 0 = no items, otherwise 1+max depth of items refered to
vector<CardP> cards; //< All cards that pass the filter
size_t count; //< Total number of non-empty cards/items
double total_weight; //< Sum of item and card weights
size_t requested_copies; //< The requested number of copies of this pack
size_t card_copies; //< The number of cards that were chosen to come from this pack
double expected_copies;
/// Generate some copies of all cards and items
void generate_all(vector<CardP>* out, size_t copies);
/// Generate one card/item chosen at random (using the select type)
void generate_one_random(vector<CardP>* out);
};
class PackGenerator {
public:
/// Reset the generator, possibly switching the set or reseeding
void reset(const SetP& set, int seed);
/// Reset the generator, but not the set
void reset(int seed);
/// Find the PackInstance for the PackType with the given name
PackInstance& get(const String& name);