Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
This commit is contained in:
parent
396def9b66
commit
746dddc067
587 changed files with 3707 additions and 3538 deletions
|
|
@ -1130,7 +1130,7 @@ void ResourceFormatLoaderBinary::get_dependencies(const String &p_path, List<Str
|
|||
loader.get_dependencies(f, p_dependencies, p_add_types);
|
||||
}
|
||||
|
||||
Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, const Map<String, String> &p_map) {
|
||||
Error ResourceFormatLoaderBinary::rename_dependencies(const String &p_path, const HashMap<String, String> &p_map) {
|
||||
Ref<FileAccess> f = FileAccess::open(p_path, FileAccess::READ);
|
||||
ERR_FAIL_COND_V_MSG(f.is_null(), ERR_CANT_OPEN, "Cannot open file '" + p_path + "'.");
|
||||
|
||||
|
|
@ -1384,7 +1384,7 @@ void ResourceFormatSaverBinaryInstance::_pad_buffer(Ref<FileAccess> f, int p_byt
|
|||
}
|
||||
}
|
||||
|
||||
void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const Variant &p_property, Map<Ref<Resource>, int> &resource_map, Map<Ref<Resource>, int> &external_resources, Map<StringName, int> &string_map, const PropertyInfo &p_hint) {
|
||||
void ResourceFormatSaverBinaryInstance::write_variant(Ref<FileAccess> f, const Variant &p_property, HashMap<Ref<Resource>, int> &resource_map, HashMap<Ref<Resource>, int> &external_resources, HashMap<StringName, int> &string_map, const PropertyInfo &p_hint) {
|
||||
switch (p_property.get_type()) {
|
||||
case Variant::NIL: {
|
||||
f->store_32(VARIANT_NIL);
|
||||
|
|
@ -2022,7 +2022,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const Ref<Re
|
|||
// save internal resource table
|
||||
f->store_32(saved_resources.size()); //amount of internal resources
|
||||
Vector<uint64_t> ofs_pos;
|
||||
Set<String> used_unique_ids;
|
||||
RBSet<String> used_unique_ids;
|
||||
|
||||
for (Ref<Resource> &r : saved_resources) {
|
||||
if (r->is_built_in()) {
|
||||
|
|
@ -2036,7 +2036,7 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const Ref<Re
|
|||
}
|
||||
}
|
||||
|
||||
Map<Ref<Resource>, int> resource_map;
|
||||
HashMap<Ref<Resource>, int> resource_map;
|
||||
int res_index = 0;
|
||||
for (Ref<Resource> &r : saved_resources) {
|
||||
if (r->is_built_in()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue