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
a8029630
Commit
a8029630
authored
Jan 09, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tweaks to compact reading with tag.isComplex(): no longer requires that many hacks
parent
0fc9a78e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
18 deletions
+18
-18
src/data/field/choice.cpp
src/data/field/choice.cpp
+2
-12
src/data/pack.cpp
src/data/pack.cpp
+9
-4
src/util/io/get_member.cpp
src/util/io/get_member.cpp
+5
-0
src/util/io/get_member.hpp
src/util/io/get_member.hpp
+1
-1
src/util/io/writer.hpp
src/util/io/writer.hpp
+1
-1
No files found.
src/data/field/choice.cpp
View file @
a8029630
...
...
@@ -143,8 +143,8 @@ IMPLEMENT_REFLECTION_ENUM(ChoiceChoiceType) {
VALUE_N
(
"radio"
,
CHOICE_TYPE_RADIO
);
}
IMPLEMENT_REFLECTION
_NO_GET_MEMBER
(
ChoiceField
::
Choice
)
{
if
(
isGroup
()
||
line_below
||
enabled
.
isScripted
()
||
(
tag
.
reading
()
&&
tag
.
isComplex
()
))
{
IMPLEMENT_REFLECTION
(
ChoiceField
::
Choice
)
{
if
(
isGroup
()
||
line_below
||
enabled
.
isScripted
()
||
tag
.
isComplex
(
))
{
// complex values are groups
REFLECT
(
name
);
REFLECT_N
(
"group_choice"
,
default_name
);
...
...
@@ -157,16 +157,6 @@ IMPLEMENT_REFLECTION_NO_GET_MEMBER(ChoiceField::Choice) {
}
}
template
<>
void
GetDefaultMember
::
handle
(
const
ChoiceField
::
Choice
&
c
)
{
if
(
!
c
.
isGroup
())
handle
(
c
.
name
);
}
template
<>
void
GetMember
::
handle
(
const
ChoiceField
::
Choice
&
c
)
{
handle
(
_
(
"name"
),
c
.
name
);
handle
(
_
(
"group choice"
),
c
.
default_name
);
handle
(
_
(
"choices"
),
c
.
choices
);
}
// ----------------------------------------------------------------------------- : ChoiceStyle
ChoiceStyle
::
ChoiceStyle
(
const
ChoiceFieldP
&
field
)
...
...
src/data/pack.cpp
View file @
a8029630
...
...
@@ -172,7 +172,7 @@ IMPLEMENT_REFLECTION_ENUM(PackSelectType) {
VALUE_N
(
"replace"
,
SELECT_REPLACE
);
VALUE_N
(
"no replace"
,
SELECT_NO_REPLACE
);
VALUE_N
(
"cyclic"
,
SELECT_CYCLIC
);
VALUE_N
(
"
one"
,
SELECT_PROPORTIONAL
);
VALUE_N
(
"
proportional"
,
SELECT_PROPORTIONAL
);
VALUE_N
(
"nonempty"
,
SELECT_NONEMPTY
);
VALUE_N
(
"first"
,
SELECT_FIRST
);
}
...
...
@@ -198,9 +198,13 @@ IMPLEMENT_REFLECTION(PackType) {
}
IMPLEMENT_REFLECTION
(
PackItem
)
{
REFLECT
(
name
);
REFLECT
(
amount
);
REFLECT
(
probability
);
if
(
!
tag
.
isComplex
())
{
REFLECT_NAMELESS
(
name
);
}
else
{
REFLECT
(
name
);
REFLECT
(
amount
);
REFLECT
(
probability
);
}
}
...
...
@@ -389,6 +393,7 @@ void PackInstance::generate(vector<CardP>* out) {
}
else
if
(
pack_type
.
select
==
SELECT_CYCLIC
)
{
size_t
total
=
cards
.
size
()
+
pack_type
.
items
.
size
();
if
(
total
<=
0
)
total
=
1
;
// prevent div by 0
size_t
div
=
requested_copies
/
total
;
size_t
rem
=
requested_copies
%
total
;
for
(
size_t
i
=
0
;
i
<
total
;
++
i
)
{
...
...
src/util/io/get_member.cpp
View file @
a8029630
...
...
@@ -33,3 +33,8 @@ template <> void GetDefaultMember::handle(const Color& v) { value = to_sc
GetMember
::
GetMember
(
const
String
&
name
)
:
target_name
(
name
)
{}
// caused by the pattern: if (!tag.isComplex()) { REFLECT_NAMELESS(stuff) }
template
<>
void
GetMember
::
handle
(
const
String
&
v
)
{
throw
InternalError
(
_
(
"GetDefaultMember::handle"
));
}
src/util/io/get_member.hpp
View file @
a8029630
...
...
@@ -74,7 +74,7 @@ class GetMember : private GetDefaultMember {
/// Tell the reflection code we are not reading
inline
bool
reading
()
const
{
return
false
;
}
inline
bool
scripting
()
const
{
return
true
;
}
inline
bool
isComplex
()
const
{
return
fals
e
;
}
inline
bool
isComplex
()
const
{
return
tru
e
;
}
inline
void
addAlias
(
int
,
const
Char
*
,
const
Char
*
)
{}
inline
void
handleIgnore
(
int
,
const
Char
*
)
{}
...
...
src/util/io/writer.hpp
View file @
a8029630
...
...
@@ -31,7 +31,7 @@ class Writer {
/// Tell the reflection code we are not reading
inline
bool
reading
()
const
{
return
false
;
}
inline
bool
scripting
()
const
{
return
false
;
}
inline
bool
isComplex
()
const
{
return
fals
e
;
}
inline
bool
isComplex
()
const
{
return
tru
e
;
}
inline
void
addAlias
(
int
,
const
Char
*
,
const
Char
*
)
{}
inline
void
handleIgnore
(
int
,
const
Char
*
)
{}
...
...
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