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
819ecb33
Commit
819ecb33
authored
May 15, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delayed updating of scripts on keyword changes
parent
a80dc093
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
2 deletions
+28
-2
src/data/set.cpp
src/data/set.cpp
+3
-0
src/data/set.hpp
src/data/set.hpp
+2
-0
src/gui/set/keywords_panel.cpp
src/gui/set/keywords_panel.cpp
+3
-0
src/script/script_manager.cpp
src/script/script_manager.cpp
+9
-1
src/script/script_manager.hpp
src/script/script_manager.hpp
+11
-1
No files found.
src/data/set.cpp
View file @
819ecb33
...
...
@@ -56,6 +56,9 @@ Context& Set::getContext(const CardP& card) {
void
Set
::
updateFor
(
const
CardP
&
card
)
{
script_manager
->
updateStyles
(
card
);
}
void
Set
::
updateDelayed
()
{
script_manager
->
updateDelayed
();
}
Context
&
Set
::
getContextForThumbnails
()
{
assert
(
!
wxThread
::
IsMain
());
...
...
src/data/set.hpp
View file @
819ecb33
...
...
@@ -68,6 +68,8 @@ class Set : public Packaged {
Context
&
getContext
(
const
CardP
&
card
);
/// Update styles for a card
void
updateFor
(
const
CardP
&
card
);
/// Update scripts that were delayed
void
updateDelayed
();
/// A context for performing scripts
/** Should only be used from the thumbnail thread! */
Context
&
getContextForThumbnails
();
...
...
src/gui/set/keywords_panel.cpp
View file @
819ecb33
...
...
@@ -131,6 +131,9 @@ void KeywordsPanel::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
tb
->
DeleteTool
(
ID_KEYWORD_REMOVE
);
// Menus
mb
->
Remove
(
2
);
// This is also a good moment to propagate changes
if
(
set
)
set
->
updateDelayed
();
}
void
KeywordsPanel
::
onUpdateUI
(
wxUpdateUIEvent
&
ev
)
{
...
...
src/script/script_manager.cpp
View file @
819ecb33
...
...
@@ -84,6 +84,7 @@ Context& SetScriptContext::getContext(const CardP& card) {
SetScriptManager
::
SetScriptManager
(
Set
&
set
)
:
SetScriptContext
(
set
)
,
delay
(
0
)
{
// add as an action listener for the set, so we receive actions
set
.
actions
.
addListener
(
this
);
...
...
@@ -143,7 +144,7 @@ void SetScriptManager::onAction(const Action& action, bool undone) {
value
->
keyword
.
prepare
(
set
.
game
->
keyword_parameter_types
,
true
);
set
.
keyword_db
.
clear
();
}
updateAllDependend
(
set
.
game
->
dependent_scripts_keywords
)
;
delay
|=
DELAY_KEYWORDS
;
return
;
}
// find the affected card
...
...
@@ -199,6 +200,13 @@ void SetScriptManager::updateStyles(const CardP& card) {
}
}
void
SetScriptManager
::
updateDelayed
()
{
if
(
delay
&
DELAY_KEYWORDS
)
{
updateAllDependend
(
set
.
game
->
dependent_scripts_keywords
);
}
delay
=
0
;
}
void
SetScriptManager
::
updateValue
(
Value
&
value
,
const
CardP
&
card
)
{
Age
starting_age
;
// the start of the update process
deque
<
ToUpdate
>
to_update
;
...
...
src/script/script_manager.hpp
View file @
819ecb33
...
...
@@ -58,9 +58,12 @@ class SetScriptManager : public SetScriptContext, public ActionListener {
SetScriptManager
(
Set
&
set
);
~
SetScriptManager
();
// Update all styles for a particular card
//
/
Update all styles for a particular card
void
updateStyles
(
const
CardP
&
card
);
/// Update expensive things that were previously delayed
void
updateDelayed
();
/// Update all fields of all cards
/** Update all set info fields
* Doesn't update styles
...
...
@@ -93,6 +96,13 @@ class SetScriptManager : public SetScriptContext, public ActionListener {
/// Schedule all things in deps to be updated by adding them to to_update
void
alsoUpdate
(
deque
<
ToUpdate
>&
to_update
,
const
vector
<
Dependency
>&
deps
,
const
CardP
&
card
);
/// Delayed update for (bitmask)...
enum
Delay
{
DELAY_KEYWORDS
=
0x01
,
DELAY_CARDS
=
0x02
};
int
delay
;
protected:
/// Respond to actions by updating scripts
void
onAction
(
const
Action
&
,
bool
undone
);
...
...
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