From 1386647cdf1c4278c4437523cc2b8be48c77351e Mon Sep 17 00:00:00 2001 From: Karroffel Date: Sat, 4 Nov 2017 14:08:21 +0100 Subject: make ConfigFile sections ordered --- core/io/config_file.cpp | 10 +++++----- core/io/config_file.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'core/io') diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp index b5d41bacbb..2b60150832 100644 --- a/core/io/config_file.cpp +++ b/core/io/config_file.cpp @@ -106,8 +106,8 @@ bool ConfigFile::has_section_key(const String &p_section, const String &p_key) c void ConfigFile::get_sections(List *r_sections) const { - for (const Map >::Element *E = values.front(); E; E = E->next()) { - r_sections->push_back(E->key()); + for (OrderedHashMap >::ConstElement E = values.front(); E; E = E.next()) { + r_sections->push_back(E.key()); } } void ConfigFile::get_section_keys(const String &p_section, List *r_keys) const { @@ -135,13 +135,13 @@ Error ConfigFile::save(const String &p_path) { return err; } - for (Map >::Element *E = values.front(); E; E = E->next()) { + for (OrderedHashMap >::Element E = values.front(); E; E = E.next()) { if (E != values.front()) file->store_string("\n"); - file->store_string("[" + E->key() + "]\n\n"); + file->store_string("[" + E.key() + "]\n\n"); - for (OrderedHashMap::Element F = E->get().front(); F; F = F.next()) { + for (OrderedHashMap::Element F = E.get().front(); F; F = F.next()) { String vstr; VariantWriter::write_to_string(F.get(), vstr); diff --git a/core/io/config_file.h b/core/io/config_file.h index 2be196faa2..29bd369a24 100644 --- a/core/io/config_file.h +++ b/core/io/config_file.h @@ -37,7 +37,7 @@ class ConfigFile : public Reference { GDCLASS(ConfigFile, Reference); - Map > values; + OrderedHashMap > values; PoolStringArray _get_sections() const; PoolStringArray _get_section_keys(const String &p_section) const; -- cgit v1.2.3