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
cc275f0c
Commit
cc275f0c
authored
Jan 09, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fixed SELECT_FIRST behavior: 0 >= 0
- added DoGetBestSize to PackTotalsPanel, so the text always fits
parent
a8029630
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
src/data/pack.cpp
src/data/pack.cpp
+4
-3
src/gui/set/random_pack_panel.cpp
src/gui/set/random_pack_panel.cpp
+22
-1
No files found.
src/data/pack.cpp
View file @
cc275f0c
...
@@ -300,11 +300,11 @@ void PackInstance::expect_copy(double copies) {
...
@@ -300,11 +300,11 @@ void PackInstance::expect_copy(double copies) {
}
else
if
(
pack_type
.
select
==
SELECT_PROPORTIONAL
)
{
}
else
if
(
pack_type
.
select
==
SELECT_PROPORTIONAL
)
{
i
.
expect_copy
(
copies
*
item
->
amount
*
item
->
probability
*
i
.
count
/
total_probability
);
i
.
expect_copy
(
copies
*
item
->
amount
*
item
->
probability
*
i
.
count
/
total_probability
);
}
else
if
(
pack_type
.
select
==
SELECT_NONEMPTY
)
{
}
else
if
(
pack_type
.
select
==
SELECT_NONEMPTY
)
{
if
(
i
.
count
>
=
0
)
{
if
(
i
.
count
>
0
)
{
i
.
expect_copy
(
copies
*
item
->
amount
*
item
->
probability
/
total_probability
);
i
.
expect_copy
(
copies
*
item
->
amount
*
item
->
probability
/
total_probability
);
}
}
}
else
if
(
pack_type
.
select
==
SELECT_FIRST
)
{
}
else
if
(
pack_type
.
select
==
SELECT_FIRST
)
{
if
(
i
.
count
>
=
0
&&
cards
.
empty
())
{
if
(
i
.
count
>
0
&&
cards
.
empty
())
{
i
.
expect_copy
(
copies
*
item
->
amount
);
i
.
expect_copy
(
copies
*
item
->
amount
);
break
;
break
;
}
}
...
@@ -328,6 +328,7 @@ struct RandomRange {
...
@@ -328,6 +328,7 @@ struct RandomRange {
void
PackInstance
::
generate
(
vector
<
CardP
>*
out
)
{
void
PackInstance
::
generate
(
vector
<
CardP
>*
out
)
{
card_copies
=
0
;
card_copies
=
0
;
if
(
requested_copies
==
0
)
return
;
if
(
pack_type
.
select
==
SELECT_ALL
)
{
if
(
pack_type
.
select
==
SELECT_ALL
)
{
// add all cards
// add all cards
card_copies
+=
requested_copies
*
cards
.
size
();
card_copies
+=
requested_copies
*
cards
.
size
();
...
@@ -417,7 +418,7 @@ void PackInstance::generate(vector<CardP>* out) {
...
@@ -417,7 +418,7 @@ void PackInstance::generate(vector<CardP>* out) {
// pick first nonempty item
// pick first nonempty item
FOR_EACH_CONST
(
item
,
pack_type
.
items
)
{
FOR_EACH_CONST
(
item
,
pack_type
.
items
)
{
PackInstance
&
i
=
parent
.
get
(
item
->
name
);
PackInstance
&
i
=
parent
.
get
(
item
->
name
);
if
(
i
.
count
>
=
0
)
{
if
(
i
.
count
>
0
)
{
i
.
request_copy
(
requested_copies
*
item
->
amount
);
i
.
request_copy
(
requested_copies
*
item
->
amount
);
break
;
break
;
}
}
...
...
src/gui/set/random_pack_panel.cpp
View file @
cc275f0c
...
@@ -99,6 +99,7 @@ class PackTotalsPanel : public wxPanel {
...
@@ -99,6 +99,7 @@ class PackTotalsPanel : public wxPanel {
void
addPack
(
PackType
&
pack
,
int
copies
);
void
addPack
(
PackType
&
pack
,
int
copies
);
void
addItemRef
(
PackItemRef
&
item
,
int
copies
);
void
addItemRef
(
PackItemRef
&
item
,
int
copies
);
#endif
#endif
virtual
wxSize
DoGetBestSize
()
const
;
private:
private:
DECLARE_EVENT_TABLE
();
DECLARE_EVENT_TABLE
();
GameP
game
;
GameP
game
;
...
@@ -149,7 +150,6 @@ void PackTotalsPanel::draw(DC& dc) {
...
@@ -149,7 +150,6 @@ void PackTotalsPanel::draw(DC& dc) {
dc
.
DrawLine
(
0
,
y
-
2
,
size
.
x
,
y
-
2
);
dc
.
DrawLine
(
0
,
y
-
2
,
size
.
x
,
y
-
2
);
y
+=
7
;
y
+=
7
;
drawItem
(
dc
,
y
,
_LABEL_
(
"total cards"
),
total
);
drawItem
(
dc
,
y
,
_LABEL_
(
"total cards"
),
total
);
}
}
void
PackTotalsPanel
::
drawItem
(
DC
&
dc
,
int
&
y
,
const
String
&
name
,
double
value
)
{
void
PackTotalsPanel
::
drawItem
(
DC
&
dc
,
int
&
y
,
const
String
&
name
,
double
value
)
{
wxSize
size
=
dc
.
GetSize
();
wxSize
size
=
dc
.
GetSize
();
...
@@ -161,6 +161,27 @@ void PackTotalsPanel::drawItem(DC& dc, int& y, const String& name, double value
...
@@ -161,6 +161,27 @@ void PackTotalsPanel::drawItem(DC& dc, int& y, const String& name, double value
y
+=
h
+
10
;
y
+=
h
+
10
;
}
}
wxSize
PackTotalsPanel
::
DoGetBestSize
()
const
{
// count lines
int
lines
=
0
;
#if USE_NEW_PACK_SYSTEM
if
(
game
&&
generator
.
set
)
{
FOR_EACH
(
pack
,
game
->
pack_types
)
{
PackInstance
&
i
=
generator
.
get
(
pack
);
if
(
pack
->
summary
&&
i
.
has_cards
())
lines
++
;
}
}
#else
lines
=
game
?
(
int
)
game
->
pack_items
.
size
()
:
0
;
#endif
// don't forget the total
lines
++
;
// size
int
height
=
lines
*
(
GetCharHeight
()
+
10
)
+
7
-
10
;
wxSize
ws
=
GetSize
(),
cs
=
GetClientSize
();
return
wxSize
(
0
,
height
)
+
ws
-
cs
;
}
void
PackTotalsPanel
::
setGame
(
const
GameP
&
game
)
{
void
PackTotalsPanel
::
setGame
(
const
GameP
&
game
)
{
this
->
game
=
game
;
this
->
game
=
game
;
#if !USE_NEW_PACK_SYSTEM
#if !USE_NEW_PACK_SYSTEM
...
...
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