default smart pointer type switched to intrusive_ptr

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@337 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-05-11 21:34:53 +00:00
parent 3b6743b110
commit 33fd2b5e18
103 changed files with 368 additions and 256 deletions
+1
View File
@@ -10,6 +10,7 @@
#include <script/functions/util.hpp>
#include <util/tagged_string.hpp>
#include <data/set.hpp>
#include <data/card.hpp>
#include <data/game.hpp>
DECLARE_TYPEOF_COLLECTION(pair<String COMMA ScriptValueP>);
+2 -1
View File
@@ -11,6 +11,7 @@
#include <script/image.hpp>
// used by the functions
#include <data/set.hpp>
#include <data/card.hpp>
#include <data/stylesheet.hpp>
#include <data/symbol.hpp>
#include <data/field/symbol.hpp>
@@ -78,7 +79,7 @@ SCRIPT_FUNCTION(symbol_variation) {
// find style
SCRIPT_PARAM(Set*, set);
SCRIPT_OPTIONAL_PARAM_(CardP, card);
SymbolStyleP style = dynamic_pointer_cast<SymbolStyle>(set->stylesheetFor(card)->styleFor(value->fieldP));
SymbolStyleP style = dynamic_pointer_cast<SymbolStyle>(set->stylesheetForP(card)->styleFor(value->fieldP));
if (!style) throw InternalError(_("Symbol value has a style of the wrong type"));
// find variation
FOR_EACH(v, style->variations) {
+1 -1
View File
@@ -12,7 +12,7 @@
#include <util/prec.hpp>
#include <script/value.hpp>
DECLARE_INTRUSIVE_POINTER_TYPE(Script);
DECLARE_POINTER_TYPE(Script);
// ----------------------------------------------------------------------------- : Instructions
+4 -6
View File
@@ -71,7 +71,7 @@ Context& SetScriptContext::getContext(const StyleSheetP& stylesheet) {
}
}
Context& SetScriptContext::getContext(const CardP& card) {
Context& ctx = getContext(set.stylesheetFor(card));
Context& ctx = getContext(set.stylesheetForP(card));
if (card) {
ctx.setVariable(_("card"), to_script(card));
} else {
@@ -185,15 +185,13 @@ void SetScriptManager::onAction(const Action& action, bool undone) {
void SetScriptManager::updateStyles(const CardP& card) {
// lastUpdatedCard = card;
StyleSheetP stylesheet = set.stylesheetFor(card);
const StyleSheet& stylesheet = set.stylesheetFor(card);
Context& ctx = getContext(card);
// update all styles
FOR_EACH(s, stylesheet->card_style) {
FOR_EACH_CONST(s, stylesheet.card_style) {
if (s->update(ctx)) {
s->tellListeners();
// style has changed, tell listeners
//%% ScriptStyleEvent change(stylesheet.get(), s.get());
// set->actions.tellListeners(change);
s->tellListeners();
}
}
}
+1 -1
View File
@@ -50,7 +50,7 @@ class SetScriptContext {
/** Whenever there is an action all necessary scripts are executed.
* Executes both Value scripts and Style scriptables.
*
* The context contains a normal pointer to the set, not a shared_ptr, because the set
* The context contains a normal pointer to the set, not a shared/intrusive_ptr, because the set
* itself owns this object.
*/
class SetScriptManager : public SetScriptContext, public ActionListener {
+1 -1
View File
@@ -17,7 +17,7 @@
#include <script/parser.hpp>
#include <script/to_value.hpp>
DECLARE_INTRUSIVE_POINTER_TYPE(Script);
DECLARE_POINTER_TYPE(Script);
// ----------------------------------------------------------------------------- : Store
+1 -1
View File
@@ -219,7 +219,7 @@ inline ScriptValueP to_script(const map<K,V>* v) { return new_intrusive1<Sc
template <typename K, typename V>
inline ScriptValueP to_script(const IndexMap<K,V>* v) { return new_intrusive1<ScriptMap<IndexMap<K,V> > >(v); }
template <typename T>
inline ScriptValueP to_script(const shared_ptr<T>& v) { return new_intrusive1<ScriptObject<shared_ptr<T> > >(v); }
inline ScriptValueP to_script(const intrusive_ptr<T>& v) { return new_intrusive1<ScriptObject<intrusive_ptr<T> > >(v); }
template <typename T>
inline ScriptValueP to_script(const Defaultable<T>& v) { return to_script(v()); }
+2 -2
View File
@@ -15,7 +15,7 @@ class Dependency;
// ----------------------------------------------------------------------------- : ScriptValue
DECLARE_INTRUSIVE_POINTER_TYPE(ScriptValue);
DECLARE_POINTER_TYPE(ScriptValue);
enum ScriptType
{ SCRIPT_NIL
@@ -33,7 +33,7 @@ enum ScriptType
/// A value that can be handled by the scripting engine.
/// Actual values are derived types
class ScriptValue : public IntrusivePtrBase {
class ScriptValue : public IntrusivePtrBaseWithDelete {
public:
virtual ~ScriptValue() {}