diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 16:41:43 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-05-14 21:57:34 +0200 |
commit | 0ee0fa42e6639b6fa474b7cf6afc6b1a78142185 (patch) | |
tree | 198d4ff7665d89307f6ca2469fa38620a9eb1672 /modules/opensimplex | |
parent | 07bc4e2f96f8f47991339654ff4ab16acc19d44f (diff) |
Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
Diffstat (limited to 'modules/opensimplex')
-rw-r--r-- | modules/opensimplex/noise_texture.cpp | 24 | ||||
-rw-r--r-- | modules/opensimplex/open_simplex_noise.cpp | 15 |
2 files changed, 26 insertions, 13 deletions
diff --git a/modules/opensimplex/noise_texture.cpp b/modules/opensimplex/noise_texture.cpp index 2ded998b60..1181e69cd3 100644 --- a/modules/opensimplex/noise_texture.cpp +++ b/modules/opensimplex/noise_texture.cpp @@ -124,8 +124,9 @@ void NoiseTexture::_thread_function(void *p_ud) { } void NoiseTexture::_queue_update() { - if (update_queued) + if (update_queued) { return; + } update_queued = true; call_deferred("_update_texture"); @@ -179,8 +180,9 @@ void NoiseTexture::_update_texture() { } void NoiseTexture::set_noise(Ref<OpenSimplexNoise> p_noise) { - if (p_noise == noise) + if (p_noise == noise) { return; + } if (noise.is_valid()) { noise->disconnect(CoreStringNames::get_singleton()->changed, callable_mp(this, &NoiseTexture::_queue_update)); } @@ -196,22 +198,25 @@ Ref<OpenSimplexNoise> NoiseTexture::get_noise() { } void NoiseTexture::set_width(int p_width) { - if (p_width == size.x) + if (p_width == size.x) { return; + } size.x = p_width; _queue_update(); } void NoiseTexture::set_height(int p_height) { - if (p_height == size.y) + if (p_height == size.y) { return; + } size.y = p_height; _queue_update(); } void NoiseTexture::set_seamless(bool p_seamless) { - if (p_seamless == seamless) + if (p_seamless == seamless) { return; + } seamless = p_seamless; _queue_update(); } @@ -221,8 +226,9 @@ bool NoiseTexture::get_seamless() { } void NoiseTexture::set_as_normalmap(bool p_as_normalmap) { - if (p_as_normalmap == as_normalmap) + if (p_as_normalmap == as_normalmap) { return; + } as_normalmap = p_as_normalmap; _queue_update(); _change_notify(); @@ -233,11 +239,13 @@ bool NoiseTexture::is_normalmap() { } void NoiseTexture::set_bump_strength(float p_bump_strength) { - if (p_bump_strength == bump_strength) + if (p_bump_strength == bump_strength) { return; + } bump_strength = p_bump_strength; - if (as_normalmap) + if (as_normalmap) { _queue_update(); + } } float NoiseTexture::get_bump_strength() { diff --git a/modules/opensimplex/open_simplex_noise.cpp b/modules/opensimplex/open_simplex_noise.cpp index 97b66f2c07..00b3d47db9 100644 --- a/modules/opensimplex/open_simplex_noise.cpp +++ b/modules/opensimplex/open_simplex_noise.cpp @@ -52,8 +52,9 @@ void OpenSimplexNoise::_init_seeds() { } void OpenSimplexNoise::set_seed(int p_seed) { - if (seed == p_seed) + if (seed == p_seed) { return; + } seed = p_seed; @@ -67,8 +68,9 @@ int OpenSimplexNoise::get_seed() { } void OpenSimplexNoise::set_octaves(int p_octaves) { - if (p_octaves == octaves) + if (p_octaves == octaves) { return; + } ERR_FAIL_COND_MSG(p_octaves > MAX_OCTAVES, vformat("The number of OpenSimplexNoise octaves is limited to %d; ignoring the new value.", MAX_OCTAVES)); @@ -77,22 +79,25 @@ void OpenSimplexNoise::set_octaves(int p_octaves) { } void OpenSimplexNoise::set_period(float p_period) { - if (p_period == period) + if (p_period == period) { return; + } period = p_period; emit_changed(); } void OpenSimplexNoise::set_persistence(float p_persistence) { - if (p_persistence == persistence) + if (p_persistence == persistence) { return; + } persistence = p_persistence; emit_changed(); } void OpenSimplexNoise::set_lacunarity(float p_lacunarity) { - if (p_lacunarity == lacunarity) + if (p_lacunarity == lacunarity) { return; + } lacunarity = p_lacunarity; emit_changed(); } |