diff options
Diffstat (limited to 'linden/indra/llxml/llcontrol.cpp')
-rw-r--r-- | linden/indra/llxml/llcontrol.cpp | 33 |
1 files changed, 28 insertions, 5 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 | } |