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
ccbbe432
Commit
ccbbe432
authored
Apr 28, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed dependencies for 'styling';
Fixed: specific character prefered over .* for keywords
parent
73f84fdc
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
49 additions
and
42 deletions
+49
-42
src/data/card.cpp
src/data/card.cpp
+2
-6
src/data/card.hpp
src/data/card.hpp
+1
-1
src/data/field.cpp
src/data/field.cpp
+9
-0
src/data/field.hpp
src/data/field.hpp
+2
-0
src/data/keyword.cpp
src/data/keyword.cpp
+4
-3
src/data/set.cpp
src/data/set.cpp
+4
-10
src/data/set.hpp
src/data/set.hpp
+1
-2
src/gui/control/keyword_list.cpp
src/gui/control/keyword_list.cpp
+2
-2
src/render/text/element.cpp
src/render/text/element.cpp
+1
-1
src/script/functions/basic.cpp
src/script/functions/basic.cpp
+1
-1
src/script/to_value.hpp
src/script/to_value.hpp
+22
-16
No files found.
src/data/card.cpp
View file @
ccbbe432
...
...
@@ -43,12 +43,8 @@ String Card::identification() const {
}
}
void
mark_dependency_member
(
const
CardP
&
card
,
const
String
&
name
,
const
Dependency
&
dep
)
{
// Find field with that name
IndexMap
<
FieldP
,
ValueP
>::
const_iterator
it
=
card
->
data
.
find
(
name
);
if
(
it
!=
card
->
data
.
end
())
{
(
*
it
)
->
fieldP
->
dependent_scripts
.
add
(
dep
);
}
void
mark_dependency_member
(
const
Card
&
card
,
const
String
&
name
,
const
Dependency
&
dep
)
{
mark_dependency_member
(
card
.
data
,
name
,
dep
);
}
IMPLEMENT_REFLECTION
(
Card
)
{
...
...
src/data/card.hpp
View file @
ccbbe432
...
...
@@ -69,7 +69,7 @@ class Card {
DECLARE_REFLECTION
();
};
void
mark_dependency_member
(
const
Card
P
&
value
,
const
String
&
name
,
const
Dependency
&
dep
);
void
mark_dependency_member
(
const
Card
&
value
,
const
String
&
name
,
const
Dependency
&
dep
);
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/field.cpp
View file @
ccbbe432
...
...
@@ -137,3 +137,12 @@ void init_object(const FieldP& field, ValueP& value) {
template
<>
ValueP
read_new
<
Value
>
(
Reader
&
)
{
throw
InternalError
(
_
(
"IndexMap contains nullptr ValueP the application should have crashed already"
));
}
void
mark_dependency_member
(
const
IndexMap
<
FieldP
,
ValueP
>&
value
,
const
String
&
name
,
const
Dependency
&
dep
)
{
IndexMap
<
FieldP
,
ValueP
>::
const_iterator
it
=
value
.
find
(
name
);
if
(
it
!=
value
.
end
())
{
(
*
it
)
->
fieldP
->
dependent_scripts
.
add
(
dep
);
}
}
src/data/field.hpp
View file @
ccbbe432
...
...
@@ -186,5 +186,7 @@ template <> ValueP read_new<Value>(Reader&);
return
*
static_cast
<
Type
##
Field
*>
(
fieldP
.
get
());
\
}
void
mark_dependency_member
(
const
IndexMap
<
FieldP
,
ValueP
>&
value
,
const
String
&
name
,
const
Dependency
&
dep
);
// ----------------------------------------------------------------------------- : EOF
#endif
src/data/keyword.cpp
View file @
ccbbe432
...
...
@@ -361,13 +361,14 @@ String KeywordDatabase::expand(const String& text,
}
// find 'next' trie node set matching c
FOR_EACH
(
kt
,
current
)
{
if
(
kt
->
on_any_star
)
{
next
.
push_back
(
kt
->
on_any_star
);
}
map
<
Char
,
KeywordTrie
*>::
const_iterator
it
=
kt
->
children
.
find
(
c
);
if
(
it
!=
kt
->
children
.
end
())
{
next
.
push_back
(
it
->
second
);
}
// TODO: on any star first or last?
if
(
kt
->
on_any_star
)
{
next
.
push_back
(
kt
->
on_any_star
);
}
}
// next becomes current
swap
(
current
,
next
);
...
...
src/data/set.cpp
View file @
ccbbe432
...
...
@@ -154,25 +154,19 @@ ScriptValueP make_iterator(const Set& set) {
return
new_intrusive1
<
ScriptCollectionIterator
<
vector
<
CardP
>
>
>
(
&
set
.
cards
);
}
void
mark_dependency_member
(
Set
*
value
,
const
String
&
name
,
const
Dependency
&
dep
)
{
void
mark_dependency_member
(
const
Set
&
set
,
const
String
&
name
,
const
Dependency
&
dep
)
{
// is it the card list?
if
(
name
==
_
(
"cards"
))
{
value
->
game
->
dependent_scripts_cards
.
add
(
dep
);
set
.
game
->
dependent_scripts_cards
.
add
(
dep
);
return
;
}
// is it the keywords?
if
(
name
==
_
(
"keywords"
))
{
value
->
game
->
dependent_scripts_keywords
.
add
(
dep
);
set
.
game
->
dependent_scripts_keywords
.
add
(
dep
);
return
;
}
// is it in the set data?
IndexMap
<
FieldP
,
ValueP
>::
const_iterator
it
=
value
->
data
.
find
(
name
);
if
(
it
!=
value
->
data
.
end
())
{
(
*
it
)
->
fieldP
->
dependent_scripts
.
add
(
dep
);
}
}
void
mark_dependency_member
(
const
SetP
&
value
,
const
String
&
name
,
const
Dependency
&
dep
)
{
mark_dependency_member
(
value
.
get
(),
name
,
dep
);
mark_dependency_member
(
set
.
data
,
name
,
dep
);
}
// in scripts, set.something is read from the set_info
...
...
src/data/set.hpp
View file @
ccbbe432
...
...
@@ -122,8 +122,7 @@ inline int item_count(const Set& set) {
}
ScriptValueP
make_iterator
(
const
Set
&
set
);
void
mark_dependency_member
(
const
SetP
&
value
,
const
String
&
name
,
const
Dependency
&
dep
);
void
mark_dependency_member
(
Set
*
value
,
const
String
&
name
,
const
Dependency
&
dep
);
void
mark_dependency_member
(
const
Set
&
set
,
const
String
&
name
,
const
Dependency
&
dep
);
// ----------------------------------------------------------------------------- : SetView
...
...
src/gui/control/keyword_list.cpp
View file @
ccbbe432
...
...
@@ -84,8 +84,8 @@ void KeywordList::onAction(const Action& action, bool undone) {
String
match_string
(
const
Keyword
&
a
)
{
return
untag
(
replace_all
(
replace_all
(
a
.
match
,
_
(
"<atom-param>"
),
_
(
"<"
)
),
_
(
"</atom-param>"
),
_
(
">"
)
)
_
(
"<atom-param>"
),
LEFT_ANGLE_BRACKET
),
_
(
"</atom-param>"
),
RIGHT_ANGLE_BRACKET
)
);
}
...
...
src/render/text/element.cpp
View file @
ccbbe432
...
...
@@ -174,7 +174,7 @@ struct TextElementsFromString {
line
>
0
?
BREAK_LINE
:
BREAK_HARD
);
}
if
(
bracket
)
{
e
->
content
=
String
(
_
(
"<"
))
+
c
+
_
(
">"
)
;
e
->
content
=
String
(
LEFT_ANGLE_BRACKET
)
+
c
+
RIGHT_ANGLE_BRACKET
;
}
else
{
e
->
content
=
c
;
}
...
...
src/script/functions/basic.cpp
View file @
ccbbe432
...
...
@@ -202,7 +202,7 @@ SCRIPT_FUNCTION_DEPENDENCIES(position_of) {
ScriptObject
<
CardP
>*
c
=
dynamic_cast
<
ScriptObject
<
CardP
>*>
(
of
.
get
());
if
(
s
&&
c
)
{
// dependency on cards
mark_dependency_member
(
s
->
getValue
(),
_
(
"cards"
),
dep
);
mark_dependency_member
(
*
s
->
getValue
(),
_
(
"cards"
),
dep
);
if
(
order_by
)
{
// dependency on order_by function
order_by
->
dependencies
(
ctx
,
dep
.
makeCardIndependend
());
...
...
src/script/to_value.hpp
View file @
ccbbe432
...
...
@@ -14,6 +14,23 @@
#include <util/error.hpp>
#include <util/io/get_member.hpp>
// ----------------------------------------------------------------------------- : Overloadable templates
/// Number of items in some collection like object, can be overloaded
template
<
typename
T
>
int
item_count
(
const
T
&
v
)
{
return
-
1
;
}
/// Return an iterator for some collection, can be overloaded
template
<
typename
T
>
ScriptValueP
make_iterator
(
const
T
&
v
)
{
return
ScriptValueP
();
}
/// Mark a dependency on a member of value, can be overloaded
template
<
typename
T
>
void
mark_dependency_member
(
const
T
&
value
,
const
String
&
name
,
const
Dependency
&
dep
)
{}
// ----------------------------------------------------------------------------- : Iterators
// Iterator over a collection
...
...
@@ -108,6 +125,10 @@ class ScriptMap : public ScriptValue {
virtual
int
itemCount
()
const
{
return
(
int
)
value
->
size
();
}
/// Collections can be compared by comparing pointers
virtual
const
void
*
comparePointer
()
const
{
return
value
;
}
virtual
ScriptValueP
dependencyMember
(
const
String
&
name
,
const
Dependency
&
dep
)
const
{
mark_dependency_member
(
*
value
,
name
,
dep
);
return
getMember
(
name
);
}
private:
/// Store a pointer to a collection, collections are only ever used for structures owned outside the script
const
Collection
*
value
;
...
...
@@ -132,21 +153,6 @@ class ScriptCustomCollection : public ScriptValue {
// ----------------------------------------------------------------------------- : Objects
/// Number of items in some collection like object, can be overloaded
template
<
typename
T
>
int
item_count
(
const
T
&
v
)
{
return
-
1
;
}
/// Return an iterator for some collection, can be overloaded
template
<
typename
T
>
ScriptValueP
make_iterator
(
const
T
&
v
)
{
return
ScriptValueP
();
}
/// Mark a dependency on a member of value, can be overloaded
template
<
typename
T
>
void
mark_dependency_member
(
const
T
&
value
,
const
String
&
name
,
const
Dependency
&
dep
)
{}
/// Script value containing an object (pointer)
template
<
typename
T
>
class
ScriptObject
:
public
ScriptValue
{
...
...
@@ -173,7 +179,7 @@ class ScriptObject : public ScriptValue {
}
}
virtual
ScriptValueP
dependencyMember
(
const
String
&
name
,
const
Dependency
&
dep
)
const
{
mark_dependency_member
(
value
,
name
,
dep
);
mark_dependency_member
(
*
value
,
name
,
dep
);
return
getMember
(
name
);
}
virtual
ScriptValueP
makeIterator
(
const
ScriptValueP
&
thisP
)
const
{
...
...
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