From b99070118a3cedc4fcc7514ba95fce2646d649c4 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 18 Aug 2008 23:40:50 +0000 Subject: [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 --- pokescripting/Config.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'pokescripting/Config.cpp') 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() { } -- cgit