diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-08-04 17:44:07 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-08-04 17:44:07 +0000 |
| commit | c014db49f5044f15e7ad0236437ac9ae4aa3b23f (patch) | |
| tree | ba9b1fe82b1a43155b99259d324ff444f1cdcf14 /pokescripting/Config.cpp | |
| parent | 38b4604019a93ecd053939e8e722fd36b8d7236d (diff) | |
| download | sigen-c014db49f5044f15e7ad0236437ac9ae4aa3b23f.tar.gz sigen-c014db49f5044f15e7ad0236437ac9ae4aa3b23f.tar.xz sigen-c014db49f5044f15e7ad0236437ac9ae4aa3b23f.zip | |
[FIX] Move no longer uses the overworld flag (will just check to see if the worldScript is empty)
[FIX] TeamMember now inherits from Config
[FIX] Wrapper now inherit from Config
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@235 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokescripting/Config.cpp')
| -rw-r--r-- | pokescripting/Config.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/pokescripting/Config.cpp b/pokescripting/Config.cpp index 8e429fb8..3e2e3adc 100644 --- a/pokescripting/Config.cpp +++ b/pokescripting/Config.cpp @@ -34,9 +34,37 @@ void Pokescripting::Config::setValue(const QString& name, const QVariant& value) m_values[name] = value; } -QVariant Pokescripting::Config::value(const QString& name) +void Pokescripting::Config::removeValue(const QString& name) +{ + m_values.remove(name); +} + +QVariant Pokescripting::Config::value(const QString& name, const bool recursive) const { if (m_values.contains(name)) return m_values[name]; + if (recursive) + { + QObject* par = parent(); + while (par) + { + if (qobject_cast<Config*>(par) && qobject_cast<Config*>(par)->hasValue(name)) + return qobject_cast<Config*>(par)->value(name); + par = par->parent(); + } + } return QVariant(); } + +bool Pokescripting::Config::hasValue(const QString& name, const bool recursive) const +{ + if (m_values.contains(name)) + return true; + if (recursive && qobject_cast<Config*>(parent())) + return qobject_cast<Config*>(parent())->hasValue(name, true); + return false; +} + +void Pokescripting::Config::writeBack() +{ +} |
