Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
4c998552
Commit
4c998552
authored
Jan 09, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added CustomPackDialog for user constructed PackTypes.
There is no UI for using these custom types yet.
parent
8d0d8dc1
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
196 additions
and
44 deletions
+196
-44
src/data/pack.cpp
src/data/pack.cpp
+14
-3
src/data/pack.hpp
src/data/pack.hpp
+2
-1
src/gui/set/random_pack_panel.cpp
src/gui/set/random_pack_panel.cpp
+164
-33
src/gui/set/random_pack_panel.hpp
src/gui/set/random_pack_panel.hpp
+15
-7
src/util/window_id.hpp
src/util/window_id.hpp
+1
-0
No files found.
src/data/pack.cpp
View file @
4c998552
...
@@ -190,6 +190,10 @@ IMPLEMENT_REFLECTION(PackType) {
...
@@ -190,6 +190,10 @@ IMPLEMENT_REFLECTION(PackType) {
if
(
filter
)
select
=
SELECT_NO_REPLACE
;
if
(
filter
)
select
=
SELECT_NO_REPLACE
;
else
if
(
!
items
.
empty
())
select
=
SELECT_ALL
;
else
if
(
!
items
.
empty
())
select
=
SELECT_ALL
;
}
}
if
(
indeterminate
(
summary
))
{
if
(
filter
)
summary
=
true
;
else
if
(
!
items
.
empty
())
summary
=
false
;
}
if
(
indeterminate
(
selectable
))
{
if
(
indeterminate
(
selectable
))
{
if
(
filter
)
selectable
=
false
;
if
(
filter
)
selectable
=
false
;
else
if
(
!
items
.
empty
())
selectable
=
true
;
else
if
(
!
items
.
empty
())
selectable
=
true
;
...
@@ -211,12 +215,19 @@ IMPLEMENT_REFLECTION(PackItem) {
...
@@ -211,12 +215,19 @@ IMPLEMENT_REFLECTION(PackItem) {
PackType
::
PackType
()
PackType
::
PackType
()
:
enabled
(
true
)
:
enabled
(
true
)
,
selectable
(
indeterminate
)
,
selectable
(
indeterminate
)
,
summary
(
tru
e
)
,
summary
(
indeterminat
e
)
,
select
(
SELECT_AUTO
)
,
select
(
SELECT_AUTO
)
{}
{}
PackItem
::
PackItem
()
PackItem
::
PackItem
()
:
amount
(
1
)
:
amount
(
1
)
,
probability
(
1
)
{}
PackItem
::
PackItem
(
const
String
&
name
,
int
amount
)
:
name
(
name
)
,
amount
(
amount
)
,
probability
(
1
)
{}
{}
...
@@ -380,7 +391,7 @@ void PackInstance::generate(vector<CardP>* out) {
...
@@ -380,7 +391,7 @@ void PackInstance::generate(vector<CardP>* out) {
}
else
if
(
pack_type
.
select
==
SELECT_NO_REPLACE
)
{
}
else
if
(
pack_type
.
select
==
SELECT_NO_REPLACE
)
{
card_copies
+=
requested_copies
;
card_copies
+=
requested_copies
;
// NOTE: there is no way to pick items without replacement
// NOTE: there is no way to pick items without replacement
if
(
out
)
{
if
(
out
&&
!
cards
.
empty
()
)
{
// to prevent us from being too predictable for small sets, periodically reshuffle
// to prevent us from being too predictable for small sets, periodically reshuffle
RandomRange
<
boost
::
mt19937
>
gen_range
(
parent
.
gen
);
RandomRange
<
boost
::
mt19937
>
gen_range
(
parent
.
gen
);
int
max_per_batch
=
((
int
)
cards
.
size
()
+
1
)
/
2
;
int
max_per_batch
=
((
int
)
cards
.
size
()
+
1
)
/
2
;
...
@@ -394,7 +405,7 @@ void PackInstance::generate(vector<CardP>* out) {
...
@@ -394,7 +405,7 @@ void PackInstance::generate(vector<CardP>* out) {
}
else
if
(
pack_type
.
select
==
SELECT_CYCLIC
)
{
}
else
if
(
pack_type
.
select
==
SELECT_CYCLIC
)
{
size_t
total
=
cards
.
size
()
+
pack_type
.
items
.
size
();
size_t
total
=
cards
.
size
()
+
pack_type
.
items
.
size
();
if
(
total
<=
0
)
total
=
1
;
// prevent div by 0
if
(
total
==
0
)
return
;
// prevent div by 0
size_t
div
=
requested_copies
/
total
;
size_t
div
=
requested_copies
/
total
;
size_t
rem
=
requested_copies
%
total
;
size_t
rem
=
requested_copies
%
total
;
for
(
size_t
i
=
0
;
i
<
total
;
++
i
)
{
for
(
size_t
i
=
0
;
i
<
total
;
++
i
)
{
...
...
src/data/pack.hpp
View file @
4c998552
...
@@ -137,7 +137,7 @@ class PackType : public IntrusivePtrBase<PackType> {
...
@@ -137,7 +137,7 @@ class PackType : public IntrusivePtrBase<PackType> {
String
name
;
///< Name of this pack
String
name
;
///< Name of this pack
Scriptable
<
bool
>
enabled
;
///< Is this pack enabled?
Scriptable
<
bool
>
enabled
;
///< Is this pack enabled?
tribool
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?
tribool
summary
;
///< Should the total be listed for this type?
PackSelectType
select
;
///< What cards/items to select
PackSelectType
select
;
///< What cards/items to select
OptionalScript
filter
;
///< Filter to select this type of cards
OptionalScript
filter
;
///< Filter to select this type of cards
vector
<
PackItemP
>
items
;
///< Subpacks in this pack
vector
<
PackItemP
>
items
;
///< Subpacks in this pack
...
@@ -153,6 +153,7 @@ class PackType : public IntrusivePtrBase<PackType> {
...
@@ -153,6 +153,7 @@ class PackType : public IntrusivePtrBase<PackType> {
class
PackItem
:
public
IntrusivePtrBase
<
PackItem
>
{
class
PackItem
:
public
IntrusivePtrBase
<
PackItem
>
{
public:
public:
PackItem
();
PackItem
();
PackItem
(
const
String
&
name
,
int
amount
);
String
name
;
///< Name of the pack to select cards from
String
name
;
///< Name of the pack to select cards from
Scriptable
<
int
>
amount
;
///< Number of cards of this type
Scriptable
<
int
>
amount
;
///< Number of cards of this type
...
...
src/gui/set/random_pack_panel.cpp
View file @
4c998552
This diff is collapsed.
Click to expand it.
src/gui/set/random_pack_panel.hpp
View file @
4c998552
...
@@ -20,6 +20,19 @@ class PackTotalsPanel;
...
@@ -20,6 +20,19 @@ class PackTotalsPanel;
struct
CardSelectEvent
;
struct
CardSelectEvent
;
DECLARE_POINTER_TYPE
(
PackType
);
DECLARE_POINTER_TYPE
(
PackType
);
// ----------------------------------------------------------------------------- : Utility
// for lists of spin controls
struct
PackAmountPicker
{
PackTypeP
pack
;
wxStaticText
*
label
;
wxSpinCtrl
*
value
;
PackAmountPicker
()
{}
PackAmountPicker
(
wxWindow
*
parent
,
wxFlexGridSizer
*
sizer
,
const
PackTypeP
&
pack
);
void
destroy
(
wxFlexGridSizer
*
sizer
);
};
// ----------------------------------------------------------------------------- : RandomPackPanel
// ----------------------------------------------------------------------------- : RandomPackPanel
/// A SetWindowPanel for creating random booster packs
/// A SetWindowPanel for creating random booster packs
...
@@ -59,16 +72,11 @@ class RandomPackPanel : public SetWindowPanel {
...
@@ -59,16 +72,11 @@ class RandomPackPanel : public SetWindowPanel {
wxButton
*
generate_button
;
wxButton
*
generate_button
;
wxRadioButton
*
seed_random
,
*
seed_fixed
;
wxRadioButton
*
seed_random
,
*
seed_fixed
;
PackTotalsPanel
*
totals
;
PackTotalsPanel
*
totals
;
vector
<
PackAmountPicker
>
pickers
;
struct
PackItem
{
PackTypeP
pack
;
wxStaticText
*
label
;
wxSpinCtrl
*
value
;
};
vector
<
PackItem
>
packs
;
#if USE_NEW_PACK_SYSTEM
#if USE_NEW_PACK_SYSTEM
PackGenerator
generator
;
PackGenerator
generator
;
int
last_seed
;
#endif
#endif
/// Actual intialization of the controls
/// Actual intialization of the controls
...
...
src/util/window_id.hpp
View file @
4c998552
...
@@ -201,6 +201,7 @@ enum ChildMenuID {
...
@@ -201,6 +201,7 @@ enum ChildMenuID {
,
ID_SEED_RANDOM
,
ID_SEED_RANDOM
,
ID_SEED_FIXED
,
ID_SEED_FIXED
,
ID_GENERATE_PACK
,
ID_GENERATE_PACK
,
ID_CUSTOM_PACK
// SymbolFont (Format menu)
// SymbolFont (Format menu)
,
ID_INSERT_SYMBOL_MENU_MIN
=
9001
,
ID_INSERT_SYMBOL_MENU_MIN
=
9001
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment