summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Buring <ricardo.buring@gmail.com>2022-05-17 10:53:59 +0200
committerRicardo Buring <ricardo.buring@gmail.com>2022-05-17 14:49:58 +0200
commit9d9b50855c5fd7bbba4f8494fbcd0b6dc6da87db (patch)
tree192dac7d41bfe37a2f3f33648d95408d15cc3c15
parent4654de547458cc69a36abf6df65c219469abfa85 (diff)
ProjectSettings: use RBMap again instead of HashMap
This fixes corruption of project.godot and failure to load global classes.
-rw-r--r--core/config/project_settings.cpp8
-rw-r--r--core/config/project_settings.h6
2 files changed, 7 insertions, 7 deletions
diff --git a/core/config/project_settings.cpp b/core/config/project_settings.cpp
index 3ef9a69d06..4638d70e59 100644
--- a/core/config/project_settings.cpp
+++ b/core/config/project_settings.cpp
@@ -764,7 +764,7 @@ Error ProjectSettings::save() {
return error;
}
-Error ProjectSettings::_save_settings_binary(const String &p_file, const HashMap<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
+Error ProjectSettings::_save_settings_binary(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
Error err;
Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
ERR_FAIL_COND_V_MSG(err != OK, err, "Couldn't save project.binary at " + p_file + ".");
@@ -832,7 +832,7 @@ Error ProjectSettings::_save_settings_binary(const String &p_file, const HashMap
return OK;
}
-Error ProjectSettings::_save_settings_text(const String &p_file, const HashMap<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
+Error ProjectSettings::_save_settings_text(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom, const String &p_custom_features) {
Error err;
Ref<FileAccess> file = FileAccess::open(p_file, FileAccess::WRITE, &err);
@@ -947,7 +947,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
for (const KeyValue<String, Variant> &E : p_custom) {
// Lookup global prop to store in the same order
- HashMap<StringName, VariantContainer>::Iterator global_prop = props.find(E.key);
+ RBMap<StringName, VariantContainer>::Iterator global_prop = props.find(E.key);
_VCSort vc;
vc.name = E.key;
@@ -957,7 +957,7 @@ Error ProjectSettings::save_custom(const String &p_path, const CustomMap &p_cust
vclist.insert(vc);
}
- HashMap<String, List<String>> props;
+ RBMap<String, List<String>> props;
for (RBSet<_VCSort>::Element *E = vclist.front(); E; E = E->next()) {
String category = E->get().name;
diff --git a/core/config/project_settings.h b/core/config/project_settings.h
index f8dc618cb8..bacc8adc54 100644
--- a/core/config/project_settings.h
+++ b/core/config/project_settings.h
@@ -84,7 +84,7 @@ protected:
int last_builtin_order = 0;
uint64_t last_save_time = 0;
- HashMap<StringName, VariantContainer> props;
+ RBMap<StringName, VariantContainer> props; // NOTE: Key order is used e.g. in the save_custom method.
String resource_path;
HashMap<StringName, PropertyInfo> custom_prop_info;
bool disable_feature_overrides = false;
@@ -108,8 +108,8 @@ protected:
Error _load_settings_binary(const String &p_path);
Error _load_settings_text_or_binary(const String &p_text_path, const String &p_bin_path);
- Error _save_settings_text(const String &p_file, const HashMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
- Error _save_settings_binary(const String &p_file, const HashMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
+ Error _save_settings_text(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
+ Error _save_settings_binary(const String &p_file, const RBMap<String, List<String>> &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
Error _save_custom_bnd(const String &p_file);