summaryrefslogtreecommitdiff
path: root/indra/llxml/llcontrol.cpp
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2008-04-28 23:29:46 +0000
committerSteven Bennetts <steve@lindenlab.com>2008-04-28 23:29:46 +0000
commit16baf6c9d43fc29e697b5a460439ca664897450c (patch)
tree6c3ae45c538cbc90408ab72f3a02564cf5dce754 /indra/llxml/llcontrol.cpp
parent75ee8558abb662b6a0a6b559c61a9549818d2962 (diff)
merge release-QAR-499 Viewer 1.20 RC 3
merge release-QAR-508 Viewer 1.20 RC 4 merge Branch_1-20-Viewer -r 85278 : 85828 -> release
Diffstat (limited to 'indra/llxml/llcontrol.cpp')
-rw-r--r--indra/llxml/llcontrol.cpp33
1 files changed, 28 insertions, 5 deletions
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index a1d2620a6f..2c4fb3bccc 100644
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -953,7 +953,7 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only)
return num_saved;
}
-U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declaration, eControlType declare_as)
+U32 LLControlGroup::loadFromFile(const LLString& filename)
{
LLString name;
LLSD settings;
@@ -965,24 +965,47 @@ U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declarat
llwarns << "Cannot find file " << filename << " to load." << llendl;
return 0;
}
+
S32 ret = LLSDSerialize::fromXML(settings, infile);
+
if (ret <= 0)
{
infile.close();
llwarns << "Unable to open LLSD control file " << filename << ". Trying Legacy Method." << llendl;
- return loadFromFileLegacy(filename, require_declaration, declare_as);
+ return loadFromFileLegacy(filename, TRUE, TYPE_STRING);
}
- U32 validitems = 0;
+ U32 validitems = 0;
int persist = 1;
for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr)
{
name = (*itr).first;
control_map = (*itr).second;
- if(control_map.has("Persist")) persist = control_map["Persist"].asInteger();
+ if(control_map.has("Persist"))
+ {
+ persist = control_map["Persist"].asInteger();
+ }
- declareControl(name, typeStringToEnum(control_map["Type"].asString()), control_map["Value"], control_map["Comment"].asString(), persist);
+ // If the control exists just set the value from the input file.
+ LLControlVariable* existing_control = getControl(name);
+ if(existing_control)
+ {
+ // Check persistence. If not persisted, we shouldn't be loading.
+ if(existing_control->isPersisted())
+ {
+ existing_control->setValue(control_map["Value"]);
+ }
+ }
+ else
+ {
+ declareControl(name,
+ typeStringToEnum(control_map["Type"].asString()),
+ control_map["Value"],
+ control_map["Comment"].asString(),
+ persist
+ );
+ }
++validitems;
}