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
c2af0830
Commit
c2af0830
authored
Jun 18, 2008
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Also init dependencies of non rule form expand_keywords
parent
fcd75a64
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
10 deletions
+24
-10
src/script/context.cpp
src/script/context.cpp
+4
-0
src/script/context.hpp
src/script/context.hpp
+2
-0
src/script/functions/basic.cpp
src/script/functions/basic.cpp
+2
-1
src/script/functions/util.hpp
src/script/functions/util.hpp
+15
-9
src/script/script_manager.cpp
src/script/script_manager.cpp
+1
-0
No files found.
src/script/context.cpp
View file @
c2af0830
...
...
@@ -232,6 +232,10 @@ ScriptValueP Context::getVariable(Variable var) {
if
(
variables
[
var
].
value
)
return
variables
[
var
].
value
;
throw
ScriptError
(
_
(
"Variable not set: "
)
+
variable_to_string
(
var
));
}
ScriptValueP
Context
::
getVariableInScopeOpt
(
Variable
var
)
{
if
(
variables
[
var
].
level
==
level
)
return
variables
[
var
].
value
;
else
return
ScriptValueP
();
}
int
Context
::
getVariableScope
(
Variable
var
)
{
if
(
variables
[
var
].
value
)
return
level
-
variables
[
var
].
level
;
else
return
-
1
;
...
...
src/script/context.hpp
View file @
c2af0830
...
...
@@ -62,6 +62,8 @@ class Context {
ScriptValueP
getVariable
(
Variable
var
);
/// Get the value of a variable, returns ScriptValue() if it is not set
inline
ScriptValueP
getVariableOpt
(
Variable
var
)
{
return
variables
[
var
].
value
;
}
/// Get the value of a variable only if it was set in the current scope, returns ScriptValue() if it is not set
ScriptValueP
getVariableInScopeOpt
(
Variable
var
);
/// In what scope was the variable set?
/** Returns 0 for the current scope and >0 for outer scopes.
* Returns -1 if the varible is not set
...
...
src/script/functions/basic.cpp
View file @
c2af0830
...
...
@@ -314,6 +314,7 @@ SCRIPT_FUNCTION(sort_list) {
// ----------------------------------------------------------------------------- : Keywords
SCRIPT_RULE_2_N_DEP
(
expand_keywords
,
ScriptValueP
,
_
(
"default expand"
),
default_expand
,
ScriptValueP
,
_
(
"combine"
),
combine
)
{
SCRIPT_PARAM_C
(
String
,
input
);
...
...
@@ -338,7 +339,7 @@ SCRIPT_RULE_2_DEPENDENCIES(expand_keywords) {
combine
->
dependencies
(
ctx
,
dep
);
SCRIPT_PARAM_C
(
Set
*
,
set
);
set
->
game
->
dependent_scripts_keywords
.
add
(
dep
);
// this depends on the set's keywords
SCRIPT_RETURN
(
_
(
""
)
);
return
ctx
.
getVariable
(
SCRIPT_VAR_input
);
}
SCRIPT_FUNCTION
(
keyword_usage
)
{
...
...
src/script/functions/util.hpp
View file @
c2af0830
...
...
@@ -175,19 +175,24 @@ inline Type from_script(const ScriptValueP& v, Variable var) {
ScriptValueP
ScriptRule_
##
funname
::
eval
(
Context
&
ctx
)
const
/// Utility for defining a script rule with two parameters
#define SCRIPT_RULE_2(funname, type1, name1, type2, name2) \
#define SCRIPT_RULE_2(funname, type1, name1, type2, name2)
\
SCRIPT_RULE_2_N
(
funname
,
type1
,
_
(
#
name1
),
name1
,
type2
,
_
(
#
name2
),
name2
)
#define SCRIPT_RULE_2_C(funname, type1, name1, type2, name2) \
SCRIPT_RULE_2_N
(
funname
,
type1
,
SCRIPT_VAR_
##
name1
,
name1
,
type2
,
SCRIPT_VAR_
##
name2
,
name2
)
/// Utility for defining a script rule with two named parameters
#define SCRIPT_RULE_2_N(funname, type1, str1, name1, type2, str2, name2) \
SCRIPT_RULE_2_N_AUX
(
funname
,
type1
,
str1
,
name1
,
type2
,
str2
,
name2
,
;)
#define SCRIPT_RULE_2_N(funname, type1, str1, name1, type2, str2, name2)
\
SCRIPT_RULE_2_N_AUX
(
funname
,
type1
,
str1
,
name1
,
type2
,
str2
,
name2
,
;
,
;
)
/// Utility for defining a script rule with two named parameters, with dependencies
#define SCRIPT_RULE_2_N_DEP(funname, type1, str1, name1, type2, str2, name2)\
SCRIPT_RULE_2_N_AUX
(
funname
,
type1
,
str1
,
name1
,
type2
,
str2
,
name2
,
\
virtual
ScriptValueP
dependencies
(
Context
&
,
const
Dependency
&
)
const
;)
#define SCRIPT_RULE_2_N_AUX(funname, type1, str1, name1, type2, str2, name2, dep) \
#define SCRIPT_RULE_2_N_DEP(funname, type1, str1, name1, type2, str2, name2) \
SCRIPT_RULE_2_N_AUX
(
funname
,
type1
,
str1
,
name1
,
type2
,
str2
,
name2
,
\
virtual
ScriptValueP
dependencies
(
Context
&
,
const
Dependency
&
)
const
;,
\
SCRIPT_FUNCTION_DEPENDENCIES
(
funname
)
{
\
SCRIPT_PARAM_N
(
type1
,
str1
,
name1
);
\
SCRIPT_PARAM_N
(
type2
,
str2
,
name2
);
\
return
ScriptRule_
##
funname
(
name1
,
name2
).
dependencies
(
ctx
,
dep
);
\
})
#define SCRIPT_RULE_2_N_AUX(funname, type1, str1, name1, type2, str2, name2, dep, more) \
class
ScriptRule_
##
funname
:
public
ScriptValue
{
\
public:
\
inline
ScriptRule_
##
funname
(
const
type1
&
name1
,
const
type2
&
name2
)
\
...
...
@@ -205,11 +210,12 @@ inline Type from_script(const ScriptValueP& v, Variable var) {
SCRIPT_PARAM_N
(
type2
,
str2
,
name2
);
\
return
new_intrusive2
<
ScriptRule_
##
funname
>
(
name1
,
name2
);
\
}
\
SCRIPT_FUNCTION
(
funname
)
{
\
SCRIPT_FUNCTION
_AUX
(
funname
,
dep
)
{
\
SCRIPT_PARAM_N
(
type1
,
str1
,
name1
);
\
SCRIPT_PARAM_N
(
type2
,
str2
,
name2
);
\
return
ScriptRule_
##
funname
(
name1
,
name2
).
eval
(
ctx
);
\
}
\
more
\
ScriptValueP
ScriptRule_
##
funname
::
eval
(
Context
&
ctx
)
const
#define SCRIPT_RULE_2_DEPENDENCIES(name) \
...
...
src/script/script_manager.cpp
View file @
c2af0830
...
...
@@ -278,6 +278,7 @@ void SetScriptManager::updateAll() {
#ifdef LOG_UPDATES
wxLogDebug
(
_
(
"Update all"
));
#endif
wxBusyCursor
busy
;
// update set data
Context
&
ctx
=
getContext
(
set
.
stylesheet
);
FOR_EACH
(
v
,
set
.
data
)
{
...
...
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