diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-08-18 23:40:50 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-08-18 23:40:50 +0000 |
| commit | b99070118a3cedc4fcc7514ba95fce2646d649c4 (patch) | |
| tree | 186d30a5ace8bd07e252c67804622d3d38f96fb4 /pokescripting/Config.cpp | |
| parent | 91a1658e4f949dc9c06f594956fa2c3d9b73b423 (diff) | |
| download | sigen-b99070118a3cedc4fcc7514ba95fce2646d649c4.tar.gz sigen-b99070118a3cedc4fcc7514ba95fce2646d649c4.tar.xz sigen-b99070118a3cedc4fcc7514ba95fce2646d649c4.zip | |
[FIX] TeamMember now allows shadowing of values
[FIX] TeamMember no longer uses pokemod internally (all is accessed through wrappers)
[FIX] Status now has the script split between Battle and World
[FIX] Script classes now able to be passed via QVariant
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@241 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokescripting/Config.cpp')
| -rw-r--r-- | pokescripting/Config.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/pokescripting/Config.cpp b/pokescripting/Config.cpp index 3e2e3adc..a0739591 100644 --- a/pokescripting/Config.cpp +++ b/pokescripting/Config.cpp @@ -23,20 +23,34 @@ Pokescripting::Config::Config(QObject* parent) : { } -void Pokescripting::Config::addValue(const QString& name, const QVariant& value) +void Pokescripting::Config::addValue(const QString& name, const QVariant& value, const bool temporary) { if (!m_values.contains(name)) - m_values[name] = value; + { + setValue(name, value, temporary); + emit(valueAdded(name, value)); + } } -void Pokescripting::Config::setValue(const QString& name, const QVariant& value) +void Pokescripting::Config::setValue(const QString& name, const QVariant& value, const bool temporary) { + const QVariant& oldValue = m_values[name]; m_values[name] = value; + if (temporary) + { + if (m_temporaries.contains(name)) + m_temporaries.append(name); + } + else + m_temporaries.removeAll(name); + emit(valueChanged(name, oldValue, value)); } void Pokescripting::Config::removeValue(const QString& name) { m_values.remove(name); + m_temporaries.removeAll(name); + emit(valueRemoved(name)); } QVariant Pokescripting::Config::value(const QString& name, const bool recursive) const @@ -65,6 +79,12 @@ bool Pokescripting::Config::hasValue(const QString& name, const bool recursive) return false; } +void Pokescripting::Config::clearTemporary() +{ + while (m_temporaries.size()) + removeValue(m_temporaries[0]); +} + void Pokescripting::Config::writeBack() { } |
