You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
[Core] Add iteration support to Array
This commit is contained in:
@@ -1313,9 +1313,7 @@ static bool compare_value(const String &p_path, const String &p_field, const Var
|
||||
} else if (p_old_value.get_type() == Variant::DICTIONARY && p_new_value.get_type() == Variant::DICTIONARY) {
|
||||
Dictionary old_dict = p_old_value;
|
||||
Dictionary new_dict = p_new_value;
|
||||
Array old_keys = old_dict.keys();
|
||||
for (int i = 0; i < old_keys.size(); i++) {
|
||||
Variant key = old_keys[i];
|
||||
for (const Variant &key : old_dict.keys()) {
|
||||
if (!new_dict.has(key)) {
|
||||
failed = true;
|
||||
print_error(vformat("Validate extension JSON: Error: Field '%s': %s was removed.", p_path, key));
|
||||
@@ -1328,9 +1326,7 @@ static bool compare_value(const String &p_path, const String &p_field, const Var
|
||||
failed = true;
|
||||
}
|
||||
}
|
||||
Array new_keys = old_dict.keys();
|
||||
for (int i = 0; i < new_keys.size(); i++) {
|
||||
Variant key = new_keys[i];
|
||||
for (const Variant &key : old_dict.keys()) {
|
||||
if (!old_dict.has(key)) {
|
||||
failed = true;
|
||||
print_error(vformat("Validate extension JSON: Error: Field '%s': %s was added with value %s.", p_path, key, new_dict[key]));
|
||||
@@ -1356,8 +1352,8 @@ static bool compare_dict_array(const Dictionary &p_old_api, const Dictionary &p_
|
||||
Array new_api = p_new_api[p_base_array];
|
||||
HashMap<String, Dictionary> new_api_assoc;
|
||||
|
||||
for (int i = 0; i < new_api.size(); i++) {
|
||||
Dictionary elem = new_api[i];
|
||||
for (const Variant &var : new_api) {
|
||||
Dictionary elem = var;
|
||||
ERR_FAIL_COND_V_MSG(!elem.has(p_name_field), false, vformat("Validate extension JSON: Element of base_array '%s' is missing field '%s'. This is a bug.", base_array, p_name_field));
|
||||
String name = elem[p_name_field];
|
||||
if (p_compare_operators && elem.has("right_type")) {
|
||||
@@ -1367,8 +1363,8 @@ static bool compare_dict_array(const Dictionary &p_old_api, const Dictionary &p_
|
||||
}
|
||||
|
||||
Array old_api = p_old_api[p_base_array];
|
||||
for (int i = 0; i < old_api.size(); i++) {
|
||||
Dictionary old_elem = old_api[i];
|
||||
for (const Variant &var : old_api) {
|
||||
Dictionary old_elem = var;
|
||||
if (!old_elem.has(p_name_field)) {
|
||||
failed = true;
|
||||
print_error(vformat("Validate extension JSON: JSON file: element of base array '%s' is missing the field: '%s'.", base_array, p_name_field));
|
||||
@@ -1508,16 +1504,16 @@ static bool compare_sub_dict_array(HashSet<String> &r_removed_classes_registered
|
||||
Array new_api = p_new_api[p_outer];
|
||||
HashMap<String, Dictionary> new_api_assoc;
|
||||
|
||||
for (int i = 0; i < new_api.size(); i++) {
|
||||
Dictionary elem = new_api[i];
|
||||
for (const Variant &var : new_api) {
|
||||
Dictionary elem = var;
|
||||
ERR_FAIL_COND_V_MSG(!elem.has(p_outer_name), false, vformat("Validate extension JSON: Element of base_array '%s' is missing field '%s'. This is a bug.", p_outer, p_outer_name));
|
||||
new_api_assoc.insert(elem[p_outer_name], elem);
|
||||
}
|
||||
|
||||
Array old_api = p_old_api[p_outer];
|
||||
|
||||
for (int i = 0; i < old_api.size(); i++) {
|
||||
Dictionary old_elem = old_api[i];
|
||||
for (const Variant &var : old_api) {
|
||||
Dictionary old_elem = var;
|
||||
if (!old_elem.has(p_outer_name)) {
|
||||
failed = true;
|
||||
print_error(vformat("Validate extension JSON: JSON file: element of base array '%s' is missing the field: '%s'.", p_outer, p_outer_name));
|
||||
|
||||
Reference in New Issue
Block a user