diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2008-11-08 06:15:08 +0000 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2008-11-08 06:15:08 +0000 |
commit | 8bad37e82371bd41864903ac0d6f49808ad119bf (patch) | |
tree | 77f0cb46059654cefb357d6eb4064c5740edf3d4 /sigscript/Config.cpp | |
parent | c127c0dae65a7600e0ab30b634f25d4915c61d16 (diff) | |
download | sigen-8bad37e82371bd41864903ac0d6f49808ad119bf.tar.gz sigen-8bad37e82371bd41864903ac0d6f49808ad119bf.tar.xz sigen-8bad37e82371bd41864903ac0d6f49808ad119bf.zip |
[FIX] No more asserts in sigmod
[FIX] Moved to using *ById instead of *Index methods in sigmod
[FIX] Tilemaps are now collaged (not completely done on the editing side yet)
[FIX] Removed the resource files (drawn natively instead)
[FIX] ATBTimer now uses the built-in QTimer in a QObject
[FIX] Coordinates are now edited on the map for warps, trainers, and effects
[FIX] Tiles are now completely scripted
[FIX] Config is now thread-safe
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@308 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'sigscript/Config.cpp')
-rw-r--r-- | sigscript/Config.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sigscript/Config.cpp b/sigscript/Config.cpp index 0340d741..3c88728b 100644 --- a/sigscript/Config.cpp +++ b/sigscript/Config.cpp @@ -19,7 +19,8 @@ #include "Config.h" Sigscript::Config::Config(QObject* parent) : - QObject(parent) + QObject(parent), + m_lock(QReadWriteLock::Recursive) { } @@ -34,6 +35,7 @@ void Sigscript::Config::addValue(const QString& name, const QVariant& value, con void Sigscript::Config::setValue(const QString& name, const QVariant& value, const Options options) { + QWriteLocker locker(&m_lock); QVariant oldValue = m_values[name].first; m_values[name] = Value(value, options); emit(valueChanged(name, oldValue, value)); @@ -41,6 +43,7 @@ void Sigscript::Config::setValue(const QString& name, const QVariant& value, con void Sigscript::Config::setOptions(const QString& name, const Options options) { + QWriteLocker locker(&m_lock); const Options oldOptions = m_values[name].second; m_values[name].second |= options; emit(optionsChanged(name, oldOptions, options)); @@ -48,6 +51,7 @@ void Sigscript::Config::setOptions(const QString& name, const Options options) void Sigscript::Config::unsetOptions(const QString& name, const Options options) { + QWriteLocker locker(&m_lock); const Options oldOptions = m_values[name].second; m_values[name].second |= ~options; emit(optionsChanged(name, oldOptions, options)); @@ -55,6 +59,7 @@ void Sigscript::Config::unsetOptions(const QString& name, const Options options) void Sigscript::Config::removeValue(const QString& name, const bool shadow) { + QWriteLocker locker(&m_lock); if (shadow) m_values[name].second |= Deleted; else @@ -64,6 +69,7 @@ void Sigscript::Config::removeValue(const QString& name, const bool shadow) QVariant Sigscript::Config::value(const QString& name, const bool recursive) const { + QReadLocker locker(&m_lock); if (m_values.contains(name)) { if (m_values[name].second & (Deleted | Hidden)) @@ -85,6 +91,7 @@ QVariant Sigscript::Config::value(const QString& name, const bool recursive) con bool Sigscript::Config::hasValue(const QString& name, const bool recursive) const { + QReadLocker locker(&m_lock); if (m_values.contains(name)) return !(m_values[name].second & (Deleted | Hidden)); if (recursive && qobject_cast<Config*>(parent())) @@ -94,6 +101,7 @@ bool Sigscript::Config::hasValue(const QString& name, const bool recursive) cons void Sigscript::Config::clean() { + QWriteLocker locker(&m_lock); for (QMutableMapIterator<QString, Value> i(m_values); i.hasNext(); i.next()) { if (i.value().second & Temporary) @@ -107,4 +115,5 @@ void Sigscript::Config::clean() void Sigscript::Config::writeBack() { + QWriteLocker locker(&m_lock); } |