From 29eefd6b105e111ada764635340407809be43776 Mon Sep 17 00:00:00 2001 From: Eric Froemling Date: Fri, 11 Dec 2020 11:37:14 -0600 Subject: [PATCH] Lint updates for the 2020.3 versions of PyCharm/CLion --- .efrocachemap | 52 ++++++++-------- .idea/dictionaries/ericf.xml | 2 + .idea/inspectionProfiles/Default.xml | 1 + .../.idea/dictionaries/ericf.xml | 6 +- .../inspectionProfiles/Project_Default.xml | 6 +- ballisticacore-cmake/.idea/modules.xml | 8 --- docs/ba_module.md | 2 +- src/ballistica/ballistica.cc | 2 +- .../dynamics/bg/bg_dynamics_height_cache.cc | 7 +-- .../dynamics/bg/bg_dynamics_server.cc | 60 +++++++++---------- src/ballistica/dynamics/collision_cache.cc | 2 +- src/ballistica/dynamics/rigid_body.cc | 1 + src/ballistica/game/game.cc | 1 + src/ballistica/generic/utils.h | 1 + src/ballistica/graphics/text/text_graphics.cc | 2 + src/ballistica/input/input.cc | 2 + src/ballistica/math/matrix44f.h | 1 + src/ballistica/math/vector2f.h | 1 + src/ballistica/math/vector3f.h | 10 ++-- src/ballistica/math/vector4f.h | 2 +- src/ballistica/python/python.cc | 2 +- src/ballistica/ui/ui.cc | 2 +- src/ballistica/ui/widget/button_widget.cc | 3 +- src/ballistica/ui/widget/h_scroll_widget.cc | 2 +- src/ballistica/ui/widget/image_widget.cc | 2 +- 25 files changed, 92 insertions(+), 88 deletions(-) delete mode 100644 ballisticacore-cmake/.idea/modules.xml diff --git a/.efrocachemap b/.efrocachemap index 6ee43ee9..e87e1aaa 100644 --- a/.efrocachemap +++ b/.efrocachemap @@ -3932,32 +3932,32 @@ "assets/build/windows/Win32/ucrtbased.dll": "https://files.ballistica.net/cache/ba1/b5/85/f8b6d0558ddb87267f34254b1450", "assets/build/windows/Win32/vc_redist.x86.exe": "https://files.ballistica.net/cache/ba1/1c/e1/4a1a2eddda2f4aebd5f8b64ab08e", "assets/build/windows/Win32/vcruntime140d.dll": "https://files.ballistica.net/cache/ba1/50/8d/bc2600ac9491f1b14d659709451f", - "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/9f/39/899e7b09787e2d30cdb996dc0810", - "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/58/91/b69eac3a1af4fb80bb314215ba9f", - "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ba/ed/2c76bd29944f4a4b97ec95c6caca", - "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ee/fc/655567f17f4c55102390ccaee221", - "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/11/20/5f4861a3747db4d8d6130287b865", - "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/a6/65/d587bd1356dd0ba5f38503ad542f", - "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a0/2a/db7a9c805e703cc7a5c305f33840", - "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/51/a2/97d4a11351b648f1c7a0d4ccffdc", - "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/84/b2/0cdac010a6d0ab618336d84364ce", - "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/dd/f5/b2a13f5965bed385184961c2b354", - "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ce/ac/eee81b5add93a6a6657a3721a3f3", - "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/44/4a/a2d432631e58a7d2a35b03fe3a3c", - "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/e0/66/e20e5da1830803a5459e7b6da9be", - "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/60/ce/6f4e5d533366a7af8b319e58c2c0", - "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/39/cd/e7d89b94ace25e654740ba17bed3", - "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/f5/a7/daaa05b5d4195863262a1a682466", - "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ea/ac/76dc570fa7a553e07f8edded0693", + "build/prefab/full/linux_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/c3/37/024056b52b1ab36a0481ead1e718", + "build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c4/5c/a572440cbca95bf0ffbe503d1602", + "build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1a/3c/5cf31bcc82f352651fd4383add39", + "build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/6d/ae/e5e6a2312028ef69df1d818147ad", + "build/prefab/full/mac_arm64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/79/cf/3807b756d7251fa122ddc31de002", + "build/prefab/full/mac_arm64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/17/72/6f0f34c727c13cb9d475ab888529", + "build/prefab/full/mac_arm64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/26/1e/72bcebdcae9c7de45d688a739e5c", + "build/prefab/full/mac_arm64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/ea/7d/c743cc744396a5055fea05403dec", + "build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/52/5e/fbc997f6fe12cd3ff6718d363685", + "build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/93/7e/901930970d61a20a8e81c6adb77f", + "build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/d5/1f/c87b3bd438c3bfc7eed8c3fdd830", + "build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/5f/fd/87486914c7a6a3b3de863e723bd8", + "build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/df/ff/77316ad5ed576772c7e54d569571", + "build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/33/0a/9c65fd6874b1fd824d1a7d994c33", + "build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/9f/f6/f7d7c08489ee52bc1f000a0de294", + "build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/1a/c2/8431f62aa377d0ba6d6833013712", + "build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d3/51/8ddfd77cd98e30b27fbeb11cfbe7", "build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/83/25/980050d75bbea49a84652209050c", - "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/be/82/432710f28c27ebb30a15c6f3692d", + "build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/81/a4/e2b3ac8eec73286f93fa0409bf88", "build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/2b/45/7f9fbae208890455fce2fbc172d3", - "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/60/49/f01b296fd59f4a15fa16be39830c", - "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/34/70/2a89f2e8130ee4bcc649ffb9fc1d", - "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/0e/f7/ff76fe963d96eb342543a5ffb0dc", - "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8e/f1/1d3cd8f97a496faf5a619cc46149", - "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/d7/c9/b5ae4d4189133b024e7b15e74ff4", - "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/00/4c/2480cfe8037055af072c2c9fa1b2", - "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/8f/30/7f0aedb2ec9b64db1566ade2fc2f", - "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ad/69/4203464dc0b509ef11967ca90612" + "build/prefab/lib/mac_arm64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/b4/2c/414ac6c258e69fba7c0cf899ae8a", + "build/prefab/lib/mac_arm64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/15/3f/23aff5bb8dd628345ade5d69c9bb", + "build/prefab/lib/mac_arm64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/71/e3/50e4404d25e65b84584ac1fa94cb", + "build/prefab/lib/mac_arm64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ff/0a/b1deb9ecc9a42c3867948a967ef1", + "build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/dc/d5/3d4e86d7221f9f32b65da512fb71", + "build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3f/7c/78754b4d3e3cd271b2815bf6c8ae", + "build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/00/5d/853823b9b4ce4511599134ffd939", + "build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/ab/2a/dbe6306405e14ecf6325decceaec" } \ No newline at end of file diff --git a/.idea/dictionaries/ericf.xml b/.idea/dictionaries/ericf.xml index 4f17acf2..ab9c73ab 100644 --- a/.idea/dictionaries/ericf.xml +++ b/.idea/dictionaries/ericf.xml @@ -68,6 +68,7 @@ anota anroid antigravity + anyofallof apichanges apis apks @@ -429,6 +430,7 @@ cryptmodule cspbd cspnf + cspre cssclass cstr csum diff --git a/.idea/inspectionProfiles/Default.xml b/.idea/inspectionProfiles/Default.xml index d496ec49..4601feea 100644 --- a/.idea/inspectionProfiles/Default.xml +++ b/.idea/inspectionProfiles/Default.xml @@ -2,6 +2,7 @@ \ No newline at end of file diff --git a/ballisticacore-cmake/.idea/modules.xml b/ballisticacore-cmake/.idea/modules.xml deleted file mode 100644 index 5fb34ea8..00000000 --- a/ballisticacore-cmake/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/docs/ba_module.md b/docs/ba_module.md index cb42539b..5551c558 100644 --- a/docs/ba_module.md +++ b/docs/ba_module.md @@ -1,5 +1,5 @@ -

last updated on 2020-12-07 for Ballistica version 1.5.29 build 20258

+

last updated on 2020-12-10 for Ballistica version 1.5.29 build 20258

This page documents the Python classes and functions in the 'ba' module, which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please let me know. Happy modding!


diff --git a/src/ballistica/ballistica.cc b/src/ballistica/ballistica.cc index 0e6d32f9..624412f5 100644 --- a/src/ballistica/ballistica.cc +++ b/src/ballistica/ballistica.cc @@ -21,7 +21,7 @@ namespace ballistica { // These are set automatically via script; don't change here. -const int kAppBuildNumber = 20258; +const int kAppBuildNumber = 20259; const char* kAppVersion = "1.5.29"; // Our standalone globals. diff --git a/src/ballistica/dynamics/bg/bg_dynamics_height_cache.cc b/src/ballistica/dynamics/bg/bg_dynamics_height_cache.cc index 36b7e38d..c0ccc083 100644 --- a/src/ballistica/dynamics/bg/bg_dynamics_height_cache.cc +++ b/src/ballistica/dynamics/bg/bg_dynamics_height_cache.cc @@ -16,10 +16,9 @@ BGDynamicsHeightCache::BGDynamicsHeightCache() y_min_(-1.0f), y_max_(1.0f), z_min_(-1.0f), - z_max_(1.0f) { - grid_width_ = 1; - grid_height_ = 1; -} + z_max_(1.0f), + grid_width_(1), + grid_height_(1) {} BGDynamicsHeightCache::~BGDynamicsHeightCache() { if (shadow_ray_) { diff --git a/src/ballistica/dynamics/bg/bg_dynamics_server.cc b/src/ballistica/dynamics/bg/bg_dynamics_server.cc index a145c24e..ffc24276 100644 --- a/src/ballistica/dynamics/bg/bg_dynamics_server.cc +++ b/src/ballistica/dynamics/bg/bg_dynamics_server.cc @@ -109,12 +109,8 @@ class BGDynamicsServer::Terrain { class BGDynamicsServer::Field { public: - Field(BGDynamicsServer* t, const Vector3f& pos, float mag) : pos_(pos) { - rad_ = 5; - mag_ = mag; - birth_time_ = t->time(); - lifespan_ = 500; - } + Field(BGDynamicsServer* t, const Vector3f& pos, float mag) + : pos_(pos), rad_(5), mag_(mag), birth_time_(t->time()), lifespan_(500) {} ~Field() = default; auto rad() const -> dReal { return rad_; } @@ -231,24 +227,25 @@ class BGDynamicsServer::Tendril { }; explicit Tendril(BGDynamicsServer* t) - : has_updated_(false), controller_(nullptr), emitting_(true) { - emit_rate_ = 0.8f + 0.4f * RandomFloat(); - birth_time_ = t->time(); - radius_ = 0.1f + RandomFloat() * 0.1f; - tex_coord_ = RandomFloat(); - start_erode_ = 0.1f; - start_spread_ = 4.0f; - side_spread_rate_ = 1.0f; - point_rand_scale_ = 1.0f; - slice_rand_scale_ = 1.0f; - tex_change_rate_ = 1.0f; - emit_rate_falloff_rate_ = 1.0f; - start_brightness_max_ = 0.9f; - start_brightness_min_ = 0.3f; - brightness_rand_ = 0.5f; - start_fade_scale_ = 1.0f; - glow_scale_ = 1.0f; - } + : has_updated_{false}, + controller_{nullptr}, + emitting_{true}, + emit_rate_{0.8f + 0.4f * RandomFloat()}, + birth_time_{t->time()}, + radius_{0.1f + RandomFloat() * 0.1f}, + tex_coord_{RandomFloat()}, + start_erode_{0.1f}, + start_spread_{4.0f}, + side_spread_rate_{1.0f}, + point_rand_scale_{1.0f}, + slice_rand_scale_{1.0f}, + tex_change_rate_{1.0f}, + emit_rate_falloff_rate_{1.0f}, + start_brightness_max_{0.9f}, + start_brightness_min_{0.3f}, + brightness_rand_{0.5f}, + start_fade_scale_{1.0f}, + glow_scale_{1.0f} {} void SetController(TendrilController* tc) { assert((controller_ == nullptr) ^ (tc == nullptr)); controller_ = tc; @@ -360,8 +357,7 @@ class BGDynamicsServer::Tendril { class BGDynamicsServer::TendrilController { public: - explicit TendrilController(Tendril* t) { - tendril_ = t; + explicit TendrilController(Tendril* t) : tendril_{t} { tendril_->SetController(this); } ~TendrilController() { @@ -392,11 +388,12 @@ class BGDynamicsServer::Chunk { type_(event.chunk_type), dynamic_(dynamic), can_die_(can_die), - tendril_controller_(nullptr) { - birth_time_ = t->time(); - flicker_ = 1.0f; - flicker_scale_ = RandomFloat(); - flicker_scale_ = 1.0f - (flicker_scale_ * flicker_scale_); + tendril_controller_(nullptr), + birth_time_{t->time()}, + flicker_{1.0f}, + flicker_scale_{1.0f} { + flicker_scale_ = RandomFloat(); // NOLINT + flicker_scale_ = 1.0f - (flicker_scale_ * flicker_scale_); // NOLINT if (type_ != BGDynamicsChunkType::kFlagStand) { if (type_ == BGDynamicsChunkType::kSplinter) { size_[0] = event.scale * 0.15f * (0.4f + 0.6f * RandomFloat()); @@ -675,6 +672,7 @@ BGDynamicsServer::BGDynamicsServer(Thread* thread) BA_PRECONDITION(g_bg_dynamics_server == nullptr); g_bg_dynamics_server = this; + // NOLINTNEXTLINE(cppcoreguidelines-prefer-member-initializer) ode_world_ = dWorldCreate(); assert(ode_world_); dWorldSetGravity(ode_world_, 0.0f, -20.0f, 0.0f); diff --git a/src/ballistica/dynamics/collision_cache.cc b/src/ballistica/dynamics/collision_cache.cc index c8ba4e78..58e190bc 100644 --- a/src/ballistica/dynamics/collision_cache.cc +++ b/src/ballistica/dynamics/collision_cache.cc @@ -12,7 +12,7 @@ namespace ballistica { -CollisionCache::CollisionCache() { test_box_ = dCreateBox(nullptr, 1, 1, 1); } +CollisionCache::CollisionCache() : test_box_{dCreateBox(nullptr, 1, 1, 1)} {} CollisionCache::~CollisionCache() { if (shadow_ray_) { diff --git a/src/ballistica/dynamics/rigid_body.cc b/src/ballistica/dynamics/rigid_body.cc index 72c29cb9..c5f30f86 100644 --- a/src/ballistica/dynamics/rigid_body.cc +++ b/src/ballistica/dynamics/rigid_body.cc @@ -351,6 +351,7 @@ auto RigidBody::AddCallback(CollideCallbackFunc callbackIn, void* data_in) auto RigidBody::CallCollideCallbacks(dContact* contacts, int count, RigidBody* opposingbody) -> bool { + // NOLINTNEXTLINE(readability-use-anyofallof) for (auto&& i : collide_callbacks_) { if (!i.callback(contacts, count, this, opposingbody, i.data)) { return false; diff --git a/src/ballistica/game/game.cc b/src/ballistica/game/game.cc index 705c2a83..fd48273e 100644 --- a/src/ballistica/game/game.cc +++ b/src/ballistica/game/game.cc @@ -1935,6 +1935,7 @@ auto Game::IsPlayerBanned(const PlayerSpec& spec) -> bool { && banned_players_.front().first < current_time) { banned_players_.pop_front(); } + // NOLINTNEXTLINE(readability-use-anyofallof) for (auto&& test_spec : banned_players_) { if (test_spec.second == spec) { return true; diff --git a/src/ballistica/generic/utils.h b/src/ballistica/generic/utils.h index 45117d82..72e2c4d0 100644 --- a/src/ballistica/generic/utils.h +++ b/src/ballistica/generic/utils.h @@ -328,6 +328,7 @@ class Utils { /// Return whether a sequence of some type pointer has nullptr members. template static auto HasNullMembers(const T& sequence) -> bool { + // NOLINTNEXTLINE(readability-use-anyofallof) for (auto&& i : sequence) { if (i == nullptr) { return true; diff --git a/src/ballistica/graphics/text/text_graphics.cc b/src/ballistica/graphics/text/text_graphics.cc index d0ee5ea8..43ebb9fb 100644 --- a/src/ballistica/graphics/text/text_graphics.cc +++ b/src/ballistica/graphics/text/text_graphics.cc @@ -941,6 +941,7 @@ void TextGraphics::GetFontPagesForText(const std::string& text, auto TextGraphics::HaveBigChars(const std::string& text) -> bool { std::vector unicode = Utils::UnicodeFromUTF8(text, "fnc93rh"); + // NOLINTNEXTLINE(readability-use-anyofallof) for (unsigned int val : unicode) { if (GetBigGlyphIndex(val) == -1) { // Don't count misses for newlines, spaces, etc. @@ -961,6 +962,7 @@ auto TextGraphics::HaveChars(const std::string& text) -> bool { return true; } else { std::vector unicode = Utils::UnicodeFromUTF8(text, "c957fj"); + // NOLINTNEXTLINE(readability-use-anyofallof) for (auto&& val : unicode) { // There's a few special chars we have. if (val >= kGlyphCount && !IsSpecialChar(val)) { diff --git a/src/ballistica/input/input.cc b/src/ballistica/input/input.cc index 10b33bfa..312d44cf 100644 --- a/src/ballistica/input/input.cc +++ b/src/ballistica/input/input.cc @@ -740,6 +740,7 @@ auto Input::GetLocalActiveInputDeviceCount() -> int { auto Input::HaveControllerWithPlayer() -> bool { assert(InGameThread()); + // NOLINTNEXTLINE(readability-use-anyofallof) for (auto& input_device : input_devices_) { if (input_device.exists() && (*input_device).IsController() && (*input_device).attached_to_player()) { @@ -751,6 +752,7 @@ auto Input::HaveControllerWithPlayer() -> bool { auto Input::HaveRemoteAppController() -> bool { assert(InGameThread()); + // NOLINTNEXTLINE(readability-use-anyofallof) for (auto& input_device : input_devices_) { if (input_device.exists() && (*input_device).IsRemoteApp()) { return true; diff --git a/src/ballistica/math/matrix44f.h b/src/ballistica/math/matrix44f.h index b90d2f2e..077e5050 100644 --- a/src/ballistica/math/matrix44f.h +++ b/src/ballistica/math/matrix44f.h @@ -148,6 +148,7 @@ class Matrix44f { } }; +// NOLINTNEXTLINE(cert-err58-cpp) const Matrix44f kMatrix44fIdentity{1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}; diff --git a/src/ballistica/math/vector2f.h b/src/ballistica/math/vector2f.h index e9ad463f..d994ae2d 100644 --- a/src/ballistica/math/vector2f.h +++ b/src/ballistica/math/vector2f.h @@ -20,6 +20,7 @@ class Vector2f { }; }; +// NOLINTNEXTLINE(cert-err58-cpp) const Vector2f kVector2f0{0.0f, 0.0f}; } // namespace ballistica diff --git a/src/ballistica/math/vector3f.h b/src/ballistica/math/vector3f.h index afc402bf..f931f393 100644 --- a/src/ballistica/math/vector3f.h +++ b/src/ballistica/math/vector3f.h @@ -189,11 +189,11 @@ class Vector3f { static auto Angle(const Vector3f& v1, const Vector3f& v2) -> float; }; -const Vector3f kVector3fX{1.0f, 0.0f, 0.0f}; -const Vector3f kVector3fY{0.0f, 1.0f, 0.0f}; -const Vector3f kVector3fZ{0.0f, 0.0f, 1.0f}; -const Vector3f kVector3f0{0.0f, 0.0f, 0.0f}; -const Vector3f kVector3f1{1.0f, 1.0f, 1.0f}; +const Vector3f kVector3fX{1.0f, 0.0f, 0.0f}; // NOLINT(cert-err58-cpp) +const Vector3f kVector3fY{0.0f, 1.0f, 0.0f}; // NOLINT(cert-err58-cpp) +const Vector3f kVector3fZ{0.0f, 0.0f, 1.0f}; // NOLINT(cert-err58-cpp) +const Vector3f kVector3f0{0.0f, 0.0f, 0.0f}; // NOLINT(cert-err58-cpp) +const Vector3f kVector3f1{1.0f, 1.0f, 1.0f}; // NOLINT(cert-err58-cpp) } // namespace ballistica diff --git a/src/ballistica/math/vector4f.h b/src/ballistica/math/vector4f.h index c66f46c5..9447657e 100644 --- a/src/ballistica/math/vector4f.h +++ b/src/ballistica/math/vector4f.h @@ -26,7 +26,7 @@ class Vector4f { }; }; -const Vector4f kVector4f0{0.0f, 0.0f, 0.0f, 0.0f}; +const Vector4f kVector4f0{0.0f, 0.0f, 0.0f, 0.0f}; // NOLINT(cert-err58-cpp) } // namespace ballistica diff --git a/src/ballistica/python/python.cc b/src/ballistica/python/python.cc index 771be7bb..62fc8d23 100644 --- a/src/ballistica/python/python.cc +++ b/src/ballistica/python/python.cc @@ -947,7 +947,7 @@ void Python::Reset(bool do_init) { const char* ver = Py_GetVersion(); - if (strncmp(ver, "3.8", 3)) { + if (strncmp(ver, "3.8", 3) != 0) { throw Exception("We require Python 3.8.x; instead found " + std::string(ver)); } diff --git a/src/ballistica/ui/ui.cc b/src/ballistica/ui/ui.cc index e2d32c04..81a95274 100644 --- a/src/ballistica/ui/ui.cc +++ b/src/ballistica/ui/ui.cc @@ -50,7 +50,7 @@ UI::UI() { g_app_globals->ui_scale = UIScale::kLarge; } else { // Use automatic val. - if (g_buildconfig.iircade_build()) { + if (g_buildconfig.iircade_build()) { // NOLINT(bugprone-branch-clone) g_app_globals->ui_scale = UIScale::kMedium; } else if (IsVRMode() || g_platform->IsRunningOnTV()) { // VR and tv builds always use medium. diff --git a/src/ballistica/ui/widget/button_widget.cc b/src/ballistica/ui/widget/button_widget.cc index 981ecc71..bc5bd975 100644 --- a/src/ballistica/ui/widget/button_widget.cc +++ b/src/ballistica/ui/widget/button_widget.cc @@ -18,14 +18,13 @@ namespace ballistica { -ButtonWidget::ButtonWidget() { +ButtonWidget::ButtonWidget() : birth_time_{g_game->master_time()} { text_ = Object::New(); SetText("Button"); text_->set_valign(TextWidget::VAlign::kCenter); text_->set_halign(TextWidget::HAlign::kCenter); text_->SetWidth(0.0f); text_->SetHeight(0.0f); - birth_time_ = g_game->master_time(); } ButtonWidget::~ButtonWidget() = default; diff --git a/src/ballistica/ui/widget/h_scroll_widget.cc b/src/ballistica/ui/widget/h_scroll_widget.cc index a970d86f..ab620d1e 100644 --- a/src/ballistica/ui/widget/h_scroll_widget.cc +++ b/src/ballistica/ui/widget/h_scroll_widget.cc @@ -31,7 +31,7 @@ void HScrollWidget::HandleRealTimerExpired(RealTimer* t) { if (!touch_is_scrolling_ && !touch_down_sent_) { ContainerWidget::HandleMessage( WidgetMessage(WidgetMessage::Type::kMouseDown, nullptr, touch_x_, - touch_y_, touch_held_click_count_)); + touch_y_, static_cast(touch_held_click_count_))); touch_down_sent_ = true; } else { } diff --git a/src/ballistica/ui/widget/image_widget.cc b/src/ballistica/ui/widget/image_widget.cc index 906b7ff3..3dd117a7 100644 --- a/src/ballistica/ui/widget/image_widget.cc +++ b/src/ballistica/ui/widget/image_widget.cc @@ -7,7 +7,7 @@ namespace ballistica { -ImageWidget::ImageWidget() { birth_time_ = g_game->master_time(); } +ImageWidget::ImageWidget() : birth_time_{g_game->master_time()} {} ImageWidget::~ImageWidget() = default;