From c014db49f5044f15e7ad0236437ac9ae4aa3b23f Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 4 Aug 2008 17:44:07 +0000 Subject: [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 --- pokescripting/Config.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'pokescripting/Config.cpp') 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(par) && qobject_cast(par)->hasValue(name)) + return qobject_cast(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(parent())) + return qobject_cast(parent())->hasValue(name, true); + return false; +} + +void Pokescripting::Config::writeBack() +{ +} -- cgit