From b2b514367824263e2dc1e26b010b0df63fd3700a Mon Sep 17 00:00:00 2001 From: est31 Date: Fri, 1 May 2015 02:53:41 +0200 Subject: Sort xml files, so order is constant Makes xml format work better with version control systems. --- core/io/resource_format_xml.cpp | 8 ++++--- core/io/resource_format_xml.h | 2 +- core/object.h | 3 +++ core/variant.cpp | 9 ++++++++ core/variant.h | 3 ++- core/variant_op.cpp | 51 ++++++++++++++++++++++++++++++----------- 6 files changed, 58 insertions(+), 18 deletions(-) diff --git a/core/io/resource_format_xml.cpp b/core/io/resource_format_xml.cpp index 50b1eba6e7..5922d83907 100644 --- a/core/io/resource_format_xml.cpp +++ b/core/io/resource_format_xml.cpp @@ -2243,12 +2243,12 @@ void ResourceFormatSaverXMLInstance::write_property(const String& p_name,const V List keys; dict.get_key_list(&keys); + keys.sort(); for(List::Element *E=keys.front();E;E=E->next()) { //if (!_check_type(dict[E->get()])) // continue; - bool ok; write_property("",E->get(),&ok); ERR_CONTINUE(!ok); @@ -2438,7 +2438,7 @@ void ResourceFormatSaverXMLInstance::_find_resources(const Variant& p_variant,bo return; if (!p_main && (!bundle_resources ) && res->get_path().length() && res->get_path().find("::") == -1 ) { - external_resources.insert(res); + external_resources.push_back(res); return; } @@ -2448,6 +2448,7 @@ void ResourceFormatSaverXMLInstance::_find_resources(const Variant& p_variant,bo List property_list; res->get_property_list( &property_list ); + property_list.sort(); List::Element *I=property_list.front(); @@ -2525,7 +2526,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res enter_tag("resource_file","type=\""+p_resource->get_type()+"\" subresource_count=\""+itos(saved_resources.size()+external_resources.size())+"\" version=\""+itos(VERSION_MAJOR)+"."+itos(VERSION_MINOR)+"\" version_name=\""+VERSION_FULL_NAME+"\""); write_string("\n",false); - for(Set::Element *E=external_resources.front();E;E=E->next()) { + for(List::Element *E=external_resources.front();E;E=E->next()) { write_tabs(); String p = E->get()->get_path(); @@ -2562,6 +2563,7 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res List property_list; res->get_property_list(&property_list); + property_list.sort(); for(List::Element *PE = property_list.front();PE;PE=PE->next()) { diff --git a/core/io/resource_format_xml.h b/core/io/resource_format_xml.h index 8bc29d3f5c..711b607668 100644 --- a/core/io/resource_format_xml.h +++ b/core/io/resource_format_xml.h @@ -125,7 +125,7 @@ class ResourceFormatSaverXMLInstance { int depth; Map resource_map; List saved_resources; - Set external_resources; + List external_resources; void enter_tag(const char* p_tag,const String& p_args=String()); void exit_tag(const char* p_tag); diff --git a/core/object.h b/core/object.h index e828a24767..44464ab199 100644 --- a/core/object.h +++ b/core/object.h @@ -111,6 +111,9 @@ struct PropertyInfo { PropertyInfo( Variant::Type p_type, const String p_name, PropertyHint p_hint=PROPERTY_HINT_NONE, const String& p_hint_string="",uint32_t p_usage=PROPERTY_USAGE_DEFAULT) { type=p_type; name=p_name; hint=p_hint; hint_string=p_hint_string; usage=p_usage; } + bool operator<(const PropertyInfo& p_info) const { + return name &array_b=*reinterpret_cast *>(p_b._data._mem);\ \ int a_len = array_a.size();\ - if (a_len!=array_b.size()){\ - _RETURN( false);\ + if (a_len m_opa array_b.size()){\ + _RETURN( m_ret_s);\ }else {\ \ DVector::Read ra = array_a.read();\ DVector::Read rb = array_b.read();\ \ for(int i=0;i(p_a._data._mem); + const Array *arr_b=reinterpret_cast(p_b._data._mem); + + int l = arr_a->size(); + if (arr_b->size()