Vectors: Use clear() and has().

Use clear() instead of resize(0).

Use has() instead of "find(p_val) != -1".
This commit is contained in:
Anilforextra
2022-02-02 00:04:13 +05:45
parent ea12094f19
commit fc27636999
36 changed files with 62 additions and 64 deletions
+7 -7
View File
@@ -661,8 +661,8 @@ void Curve2D::_bake() const {
baked_cache_dirty = false;
if (points.size() == 0) {
baked_point_cache.resize(0);
baked_dist_cache.resize(0);
baked_point_cache.clear();
baked_dist_cache.clear();
return;
}
@@ -1164,10 +1164,10 @@ void Curve3D::_bake() const {
baked_cache_dirty = false;
if (points.size() == 0) {
baked_point_cache.resize(0);
baked_tilt_cache.resize(0);
baked_up_vector_cache.resize(0);
baked_dist_cache.resize(0);
baked_point_cache.clear();
baked_tilt_cache.clear();
baked_up_vector_cache.clear();
baked_dist_cache.clear();
return;
}
@@ -1183,7 +1183,7 @@ void Curve3D::_bake() const {
baked_up_vector_cache.resize(1);
baked_up_vector_cache.set(0, Vector3(0, 1, 0));
} else {
baked_up_vector_cache.resize(0);
baked_up_vector_cache.clear();
}
return;
+2 -2
View File
@@ -1475,12 +1475,12 @@ void ArrayMesh::add_blend_shape(const StringName &p_name) {
StringName name = p_name;
if (blend_shapes.find(name) != -1) {
if (blend_shapes.has(name)) {
int count = 2;
do {
name = String(p_name) + " " + itos(count);
count++;
} while (blend_shapes.find(name) != -1);
} while (blend_shapes.has(name));
}
blend_shapes.push_back(name);