Use C++ iterators for Lists in many situations
This commit is contained in:
@@ -268,21 +268,21 @@ uint32_t PackedDataContainer::_pack(const Variant &p_data, Vector<uint8_t> &tmpd
|
||||
d.get_key_list(&keys);
|
||||
List<DictKey> sortk;
|
||||
|
||||
for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
|
||||
for (Variant &key : keys) {
|
||||
DictKey dk;
|
||||
dk.hash = E->get().hash();
|
||||
dk.key = E->get();
|
||||
dk.hash = key.hash();
|
||||
dk.key = key;
|
||||
sortk.push_back(dk);
|
||||
}
|
||||
|
||||
sortk.sort();
|
||||
|
||||
int idx = 0;
|
||||
for (List<DictKey>::Element *E = sortk.front(); E; E = E->next()) {
|
||||
encode_uint32(E->get().hash, &tmpdata.write[pos + 8 + idx * 12 + 0]);
|
||||
uint32_t ofs = _pack(E->get().key, tmpdata, string_cache);
|
||||
for (DictKey &E : sortk) {
|
||||
encode_uint32(E.hash, &tmpdata.write[pos + 8 + idx * 12 + 0]);
|
||||
uint32_t ofs = _pack(E.key, tmpdata, string_cache);
|
||||
encode_uint32(ofs, &tmpdata.write[pos + 8 + idx * 12 + 4]);
|
||||
ofs = _pack(d[E->get().key], tmpdata, string_cache);
|
||||
ofs = _pack(d[E.key], tmpdata, string_cache);
|
||||
encode_uint32(ofs, &tmpdata.write[pos + 8 + idx * 12 + 8]);
|
||||
idx++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user