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
0fc9a78e
Commit
0fc9a78e
authored
Jan 09, 2009
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mostly backwards compatibility with old pack system, uses boost tribool
parent
89d5b7ff
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
30 additions
and
5 deletions
+30
-5
src/data/game.cpp
src/data/game.cpp
+4
-0
src/data/game.hpp
src/data/game.hpp
+3
-0
src/data/pack.cpp
src/data/pack.cpp
+6
-2
src/data/pack.hpp
src/data/pack.hpp
+2
-1
src/gui/set/random_pack_panel.cpp
src/gui/set/random_pack_panel.cpp
+2
-2
src/util/io/get_member.cpp
src/util/io/get_member.cpp
+2
-0
src/util/io/reader.cpp
src/util/io/reader.cpp
+5
-0
src/util/io/writer.cpp
src/util/io/writer.cpp
+6
-0
No files found.
src/data/game.cpp
View file @
0fc9a78e
...
@@ -54,7 +54,11 @@ IMPLEMENT_REFLECTION(Game) {
...
@@ -54,7 +54,11 @@ IMPLEMENT_REFLECTION(Game) {
REFLECT_NO_SCRIPT
(
card_list_color_script
);
REFLECT_NO_SCRIPT
(
card_list_color_script
);
REFLECT_NO_SCRIPT
(
statistics_dimensions
);
REFLECT_NO_SCRIPT
(
statistics_dimensions
);
REFLECT_NO_SCRIPT
(
statistics_categories
);
REFLECT_NO_SCRIPT
(
statistics_categories
);
#if USE_NEW_PACK_SYSTEM
REFLECT_ALIAS
(
307
,
"pack item"
,
"pack type"
);
#else
REFLECT_NO_SCRIPT
(
pack_items
);
REFLECT_NO_SCRIPT
(
pack_items
);
#endif
REFLECT_NO_SCRIPT
(
pack_types
);
REFLECT_NO_SCRIPT
(
pack_types
);
REFLECT_NO_SCRIPT
(
keyword_match_script
);
REFLECT_NO_SCRIPT
(
keyword_match_script
);
REFLECT
(
has_keywords
);
REFLECT
(
has_keywords
);
...
...
src/data/game.hpp
View file @
0fc9a78e
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include <script/scriptable.hpp>
#include <script/scriptable.hpp>
#include <script/dependency.hpp>
#include <script/dependency.hpp>
#include <util/dynamic_arg.hpp>
#include <util/dynamic_arg.hpp>
#include <data/pack.hpp> // for USE_NEW_PACK_SYSTEM
DECLARE_POINTER_TYPE
(
Field
);
DECLARE_POINTER_TYPE
(
Field
);
DECLARE_POINTER_TYPE
(
Style
);
DECLARE_POINTER_TYPE
(
Style
);
...
@@ -46,7 +47,9 @@ class Game : public Packaged {
...
@@ -46,7 +47,9 @@ class Game : public Packaged {
OptionalScript
card_list_color_script
;
///< Script that determines the color of items in the card list
OptionalScript
card_list_color_script
;
///< Script that determines the color of items in the card list
vector
<
StatsDimensionP
>
statistics_dimensions
;
///< (Additional) statistics dimensions
vector
<
StatsDimensionP
>
statistics_dimensions
;
///< (Additional) statistics dimensions
vector
<
StatsCategoryP
>
statistics_categories
;
///< (Additional) statistics categories
vector
<
StatsCategoryP
>
statistics_categories
;
///< (Additional) statistics categories
#if !USE_NEW_PACK_SYSTEM
vector
<
PackItemP
>
pack_items
;
///< Types of cards in packs
vector
<
PackItemP
>
pack_items
;
///< Types of cards in packs
#endif
vector
<
PackTypeP
>
pack_types
;
///< Types of random card packs to generate
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
<
WordListP
>
word_lists
;
///< Word lists for editing with a drop down list
vector
<
AddCardsScriptP
>
add_cards_scripts
;
///< Scripts for adding multiple cards to the set
vector
<
AddCardsScriptP
>
add_cards_scripts
;
///< Scripts for adding multiple cards to the set
...
...
src/data/pack.cpp
View file @
0fc9a78e
...
@@ -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
(
selectable
))
{
if
(
filter
)
selectable
=
false
;
else
if
(
!
items
.
empty
())
selectable
=
true
;
}
}
}
}
}
...
@@ -202,7 +206,7 @@ IMPLEMENT_REFLECTION(PackItem) {
...
@@ -202,7 +206,7 @@ IMPLEMENT_REFLECTION(PackItem) {
PackType
::
PackType
()
PackType
::
PackType
()
:
enabled
(
true
)
:
enabled
(
true
)
,
selectable
(
tru
e
)
,
selectable
(
indeterminat
e
)
,
summary
(
true
)
,
summary
(
true
)
,
select
(
SELECT_AUTO
)
,
select
(
SELECT_AUTO
)
{}
{}
...
...
src/data/pack.hpp
View file @
0fc9a78e
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
#include <util/reflect.hpp>
#include <util/reflect.hpp>
#include <script/scriptable.hpp>
#include <script/scriptable.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/logic/tribool.hpp>
#define USE_NEW_PACK_SYSTEM 1
#define USE_NEW_PACK_SYSTEM 1
...
@@ -135,7 +136,7 @@ class PackType : public IntrusivePtrBase<PackType> {
...
@@ -135,7 +136,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?
bool
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?
bool
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
...
...
src/gui/set/random_pack_panel.cpp
View file @
0fc9a78e
...
@@ -268,7 +268,7 @@ void RandomPackPanel::onChangeSet() {
...
@@ -268,7 +268,7 @@ void RandomPackPanel::onChangeSet() {
// add pack controls
// add pack controls
FOR_EACH
(
pack
,
set
->
game
->
pack_types
)
{
FOR_EACH
(
pack
,
set
->
game
->
pack_types
)
{
#if NEW_PACK_SYSTEM
#if
USE_
NEW_PACK_SYSTEM
if
(
pack
->
selectable
)
{
if
(
pack
->
selectable
)
{
#endif
#endif
PackItem
i
;
PackItem
i
;
...
@@ -278,7 +278,7 @@ void RandomPackPanel::onChangeSet() {
...
@@ -278,7 +278,7 @@ void RandomPackPanel::onChangeSet() {
packsSizer
->
Add
(
i
.
label
,
0
,
wxALIGN_CENTER_VERTICAL
);
packsSizer
->
Add
(
i
.
label
,
0
,
wxALIGN_CENTER_VERTICAL
);
packsSizer
->
Add
(
i
.
value
,
0
,
wxEXPAND
|
wxALIGN_CENTER
);
packsSizer
->
Add
(
i
.
value
,
0
,
wxEXPAND
|
wxALIGN_CENTER
);
packs
.
push_back
(
i
);
packs
.
push_back
(
i
);
#if NEW_PACK_SYSTEM
#if
USE_
NEW_PACK_SYSTEM
}
}
#endif
#endif
}
}
...
...
src/util/io/get_member.cpp
View file @
0fc9a78e
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include <util/vector2d.hpp>
#include <util/vector2d.hpp>
#include <script/script.hpp>
#include <script/script.hpp>
#include <script/to_value.hpp>
#include <script/to_value.hpp>
#include <boost/logic/tribool.hpp>
// ---------------------------------------------------------------------------- : GetDefaultMember
// ---------------------------------------------------------------------------- : GetDefaultMember
...
@@ -21,6 +22,7 @@ template <> void GetDefaultMember::handle(const int& v) { value = to_sc
...
@@ -21,6 +22,7 @@ template <> void GetDefaultMember::handle(const int& v) { value = to_sc
template
<>
void
GetDefaultMember
::
handle
(
const
unsigned
int
&
v
)
{
value
=
to_script
((
int
)
v
);
}
template
<>
void
GetDefaultMember
::
handle
(
const
unsigned
int
&
v
)
{
value
=
to_script
((
int
)
v
);
}
template
<>
void
GetDefaultMember
::
handle
(
const
double
&
v
)
{
value
=
to_script
(
v
);
}
template
<>
void
GetDefaultMember
::
handle
(
const
double
&
v
)
{
value
=
to_script
(
v
);
}
template
<>
void
GetDefaultMember
::
handle
(
const
bool
&
v
)
{
value
=
to_script
(
v
);
}
template
<>
void
GetDefaultMember
::
handle
(
const
bool
&
v
)
{
value
=
to_script
(
v
);
}
template
<>
void
GetDefaultMember
::
handle
(
const
tribool
&
v
)
{
value
=
to_script
((
bool
)
v
);
}
template
<>
void
GetDefaultMember
::
handle
(
const
Vector2D
&
v
)
{
value
=
to_script
(
String
::
Format
(
_
(
"(%.10lf,%.10lf)"
),
v
.
x
,
v
.
y
));
}
template
<>
void
GetDefaultMember
::
handle
(
const
Vector2D
&
v
)
{
value
=
to_script
(
String
::
Format
(
_
(
"(%.10lf,%.10lf)"
),
v
.
x
,
v
.
y
));
}
template
<>
void
GetDefaultMember
::
handle
(
const
Color
&
v
)
{
value
=
to_script
(
v
);
}
template
<>
void
GetDefaultMember
::
handle
(
const
Color
&
v
)
{
value
=
to_script
(
v
);
}
void
GetDefaultMember
::
handle
(
const
ScriptValueP
&
v
)
{
value
=
v
;
}
void
GetDefaultMember
::
handle
(
const
ScriptValueP
&
v
)
{
value
=
v
;
}
...
...
src/util/io/reader.cpp
View file @
0fc9a78e
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include <util/vector2d.hpp>
#include <util/vector2d.hpp>
#include <util/error.hpp>
#include <util/error.hpp>
#include <util/io/package_manager.hpp>
#include <util/io/package_manager.hpp>
#include <boost/logic/tribool.hpp>
#undef small
#undef small
typedef
void
(
*
ReaderPragmaHandler
)(
String
&
);
typedef
void
(
*
ReaderPragmaHandler
)(
String
&
);
...
@@ -366,6 +367,10 @@ template <> void Reader::handle(bool& b) {
...
@@ -366,6 +367,10 @@ template <> void Reader::handle(bool& b) {
const
String
&
v
=
getValue
();
const
String
&
v
=
getValue
();
b
=
(
v
==
_
(
"true"
)
||
v
==
_
(
"1"
)
||
v
==
_
(
"yes"
));
b
=
(
v
==
_
(
"true"
)
||
v
==
_
(
"1"
)
||
v
==
_
(
"yes"
));
}
}
template
<>
void
Reader
::
handle
(
tribool
&
b
)
{
const
String
&
v
=
getValue
();
b
=
(
v
==
_
(
"true"
)
||
v
==
_
(
"1"
)
||
v
==
_
(
"yes"
));
}
// ----------------------------------------------------------------------------- : Handling less basic util types
// ----------------------------------------------------------------------------- : Handling less basic util types
template
<>
void
Reader
::
handle
(
Vector2D
&
vec
)
{
template
<>
void
Reader
::
handle
(
Vector2D
&
vec
)
{
...
...
src/util/io/writer.cpp
View file @
0fc9a78e
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include <util/error.hpp>
#include <util/error.hpp>
#include <util/version.hpp>
#include <util/version.hpp>
#include <util/io/package.hpp>
#include <util/io/package.hpp>
#include <boost/logic/tribool.hpp>
// ----------------------------------------------------------------------------- : Writer
// ----------------------------------------------------------------------------- : Writer
...
@@ -104,6 +105,11 @@ template <> void Writer::handle(const double& value) {
...
@@ -104,6 +105,11 @@ template <> void Writer::handle(const double& value) {
template
<>
void
Writer
::
handle
(
const
bool
&
value
)
{
template
<>
void
Writer
::
handle
(
const
bool
&
value
)
{
handle
(
value
?
_
(
"true"
)
:
_
(
"false"
));
handle
(
value
?
_
(
"true"
)
:
_
(
"false"
));
}
}
template
<>
void
Writer
::
handle
(
const
tribool
&
value
)
{
if
(
!
indeterminate
(
value
))
{
handle
(
value
?
_
(
"true"
)
:
_
(
"false"
));
}
}
// ----------------------------------------------------------------------------- : Handling less basic util types
// ----------------------------------------------------------------------------- : Handling less basic util types
...
...
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