diff options
author | Jacek Antonelli | 2008-08-15 23:45:45 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:45 -0500 |
commit | b1831d23bfdd0c876ac8cf687d6d3cf02345e28e (patch) | |
tree | e977d6563859940ad05af08b7bc150f57a7cb548 /linden/indra/llxml | |
parent | Second Life viewer sources 1.20.3 (diff) | |
download | meta-impy-b1831d23bfdd0c876ac8cf687d6d3cf02345e28e.zip meta-impy-b1831d23bfdd0c876ac8cf687d6d3cf02345e28e.tar.gz meta-impy-b1831d23bfdd0c876ac8cf687d6d3cf02345e28e.tar.bz2 meta-impy-b1831d23bfdd0c876ac8cf687d6d3cf02345e28e.tar.xz |
Second Life viewer sources 1.20.4
Diffstat (limited to 'linden/indra/llxml')
-rw-r--r-- | linden/indra/llxml/llcontrol.cpp | 33 | ||||
-rw-r--r-- | linden/indra/llxml/llcontrol.h | 2 |
2 files changed, 29 insertions, 6 deletions
diff --git a/linden/indra/llxml/llcontrol.cpp b/linden/indra/llxml/llcontrol.cpp index 18292d2..8c74127 100644 --- a/linden/indra/llxml/llcontrol.cpp +++ b/linden/indra/llxml/llcontrol.cpp | |||
@@ -953,7 +953,7 @@ U32 LLControlGroup::saveToFile(const LLString& filename, BOOL nondefault_only) | |||
953 | return num_saved; | 953 | return num_saved; |
954 | } | 954 | } |
955 | 955 | ||
956 | U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declaration, eControlType declare_as) | 956 | U32 LLControlGroup::loadFromFile(const LLString& filename) |
957 | { | 957 | { |
958 | LLString name; | 958 | LLString name; |
959 | LLSD settings; | 959 | LLSD settings; |
@@ -965,24 +965,47 @@ U32 LLControlGroup::loadFromFile(const LLString& filename, BOOL require_declarat | |||
965 | llwarns << "Cannot find file " << filename << " to load." << llendl; | 965 | llwarns << "Cannot find file " << filename << " to load." << llendl; |
966 | return 0; | 966 | return 0; |
967 | } | 967 | } |
968 | |||
968 | S32 ret = LLSDSerialize::fromXML(settings, infile); | 969 | S32 ret = LLSDSerialize::fromXML(settings, infile); |
970 | |||
969 | if (ret <= 0) | 971 | if (ret <= 0) |
970 | { | 972 | { |
971 | infile.close(); | 973 | infile.close(); |
972 | llwarns << "Unable to open LLSD control file " << filename << ". Trying Legacy Method." << llendl; | 974 | llwarns << "Unable to open LLSD control file " << filename << ". Trying Legacy Method." << llendl; |
973 | return loadFromFileLegacy(filename, require_declaration, declare_as); | 975 | return loadFromFileLegacy(filename, TRUE, TYPE_STRING); |
974 | } | 976 | } |
975 | 977 | ||
976 | U32 validitems = 0; | 978 | U32 validitems = 0; |
977 | int persist = 1; | 979 | int persist = 1; |
978 | for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr) | 980 | for(LLSD::map_const_iterator itr = settings.beginMap(); itr != settings.endMap(); ++itr) |
979 | { | 981 | { |
980 | name = (*itr).first; | 982 | name = (*itr).first; |
981 | control_map = (*itr).second; | 983 | control_map = (*itr).second; |
982 | 984 | ||
983 | if(control_map.has("Persist")) persist = control_map["Persist"].asInteger(); | 985 | if(control_map.has("Persist")) |
986 | { | ||
987 | persist = control_map["Persist"].asInteger(); | ||
988 | } | ||
984 | 989 | ||
985 | declareControl(name, typeStringToEnum(control_map["Type"].asString()), control_map["Value"], control_map["Comment"].asString(), persist); | 990 | // If the control exists just set the value from the input file. |
991 | LLControlVariable* existing_control = getControl(name); | ||
992 | if(existing_control) | ||
993 | { | ||
994 | // Check persistence. If not persisted, we shouldn't be loading. | ||
995 | if(existing_control->isPersisted()) | ||
996 | { | ||
997 | existing_control->setValue(control_map["Value"]); | ||
998 | } | ||
999 | } | ||
1000 | else | ||
1001 | { | ||
1002 | declareControl(name, | ||
1003 | typeStringToEnum(control_map["Type"].asString()), | ||
1004 | control_map["Value"], | ||
1005 | control_map["Comment"].asString(), | ||
1006 | persist | ||
1007 | ); | ||
1008 | } | ||
986 | 1009 | ||
987 | ++validitems; | 1010 | ++validitems; |
988 | } | 1011 | } |
diff --git a/linden/indra/llxml/llcontrol.h b/linden/indra/llxml/llcontrol.h index 9e11628..2511940 100644 --- a/linden/indra/llxml/llcontrol.h +++ b/linden/indra/llxml/llcontrol.h | |||
@@ -213,7 +213,7 @@ public: | |||
213 | // as the given type. | 213 | // as the given type. |
214 | U32 loadFromFileLegacy(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING); | 214 | U32 loadFromFileLegacy(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING); |
215 | U32 saveToFile(const LLString& filename, BOOL nondefault_only); | 215 | U32 saveToFile(const LLString& filename, BOOL nondefault_only); |
216 | U32 loadFromFile(const LLString& filename, BOOL require_declaration = TRUE, eControlType declare_as = TYPE_STRING); | 216 | U32 loadFromFile(const LLString& filename); |
217 | void resetToDefaults(); | 217 | void resetToDefaults(); |
218 | 218 | ||
219 | 219 | ||