diff --git a/CMakeLists.txt b/CMakeLists.txt index 53c26af06..0211bf3e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,7 @@ set(SFML_ENABLE_PCH true) CPMAddPackage( NAME SFML GITHUB_REPOSITORY vittorioromeo/SFML - GIT_TAG 6cdcc0caf098916fe0f5c35504b56b30fad2f92f + GIT_TAG 5415b77a2fc6fb109a0cc4a7b5fb93ae5a69b720 ) set_target_properties(sfml-system PROPERTIES UNITY_BUILD OFF) diff --git a/include/SSVOpenHexagon/SSVUtilsJson/Utils/Main.hpp b/include/SSVOpenHexagon/SSVUtilsJson/Utils/Main.hpp index 6c4794b0f..03500e770 100644 --- a/include/SSVOpenHexagon/SSVUtilsJson/Utils/Main.hpp +++ b/include/SSVOpenHexagon/SSVUtilsJson/Utils/Main.hpp @@ -24,11 +24,12 @@ inline const Obj& getObj(const Obj& mObj) noexcept /// @brief Gets a JSON Obj from another JSON Obj. /// @param mObj Source JSON Obj. /// @param mKey Key of the child. -inline Obj& getObj(Obj& mObj, const Key& mKey) noexcept +[[gnu::no_dangling]] inline Obj& getObj(Obj& mObj, const Key& mKey) noexcept { return mObj[mKey]; } -inline const Obj& getObj(const Obj& mObj, const Key& mKey) noexcept +[[gnu::no_dangling]] inline const Obj& getObj( + const Obj& mObj, const Key& mKey) noexcept { return mObj[mKey]; } diff --git a/include/SSVOpenHexagon/Utils/TinyVariant.hpp b/include/SSVOpenHexagon/Utils/TinyVariant.hpp index 197c1f5ee..c18510ef3 100644 --- a/include/SSVOpenHexagon/Utils/TinyVariant.hpp +++ b/include/SSVOpenHexagon/Utils/TinyVariant.hpp @@ -720,7 +720,10 @@ class [[nodiscard]] tinyvariant } else { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" alignas(R) byte ret_buffer[sizeof(R)]; +#pragma GCC diagnostic pop TINYVARIANT_DO_WITH_CURRENT_INDEX(I, TINYVARIANT_PLACEMENT_NEW(ret_buffer) @@ -744,7 +747,10 @@ class [[nodiscard]] tinyvariant } else { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" alignas(R) byte ret_buffer[sizeof(R)]; +#pragma GCC diagnostic pop TINYVARIANT_DO_WITH_CURRENT_INDEX(I, TINYVARIANT_PLACEMENT_NEW(ret_buffer) diff --git a/src/SSVOpenHexagon/Components/CPlayer.cpp b/src/SSVOpenHexagon/Components/CPlayer.cpp index e2409dde3..d59b6168e 100644 --- a/src/SSVOpenHexagon/Components/CPlayer.cpp +++ b/src/SSVOpenHexagon/Components/CPlayer.cpp @@ -113,6 +113,9 @@ void CPlayer::drawPivot(const unsigned int sides, const sf::Color& colorMain, const float div{ssvu::tau / sides * 0.5f}; const float pRadius{_radius * 0.75f}; + wallQuads.reserve_more_quad(sides * 1); + capTris.reserve_more(sides * 3); + for(auto i(0u); i < sides; ++i) { const float sAngle{div * 2.f * i}; @@ -126,10 +129,7 @@ void CPlayer::drawPivot(const unsigned int sides, const sf::Color& colorMain, const sf::Vector2f p4{ssvs::getOrbitRad( _startPos, sAngle - div, pRadius + baseThickness)}; - wallQuads.reserve_more_quad(1); wallQuads.batch_unsafe_emplace_back_quad(colorMain, p1, p2, p3, p4); - - capTris.reserve_more(3); capTris.batch_unsafe_emplace_back(capColor, p1, p2, _startPos); } } @@ -142,6 +142,8 @@ void CPlayer::drawDeathEffect(Utils::FastVertexVectorTris& wallQuads) const sf::Color colorMain{Utils::getColorFromHue((360.f - _hue) / 360.f)}; + wallQuads.reserve_more_quad(6); + for(auto i(0u); i < 6; ++i) { const float sAngle{div * 2.f * i}; @@ -153,7 +155,6 @@ void CPlayer::drawDeathEffect(Utils::FastVertexVectorTris& wallQuads) const sf::Vector2f p4{ ssvs::getOrbitRad(_pos, sAngle - div, dRadius + thickness)}; - wallQuads.reserve_more_quad(1); wallQuads.batch_unsafe_emplace_back_quad(colorMain, p1, p2, p3, p4); } } diff --git a/src/SSVOpenHexagon/Global/Assets.cpp b/src/SSVOpenHexagon/Global/Assets.cpp index 8bc885e75..cb002b379 100644 --- a/src/SSVOpenHexagon/Global/Assets.cpp +++ b/src/SSVOpenHexagon/Global/Assets.cpp @@ -261,8 +261,8 @@ static void loadAssetsFromJson(AssetStorage& assetStorage, return buffer; } -[[nodiscard]] static const std::vector& scanSingleByExt( - const ssvufs::Path& path, const std::string& extension) +[[nodiscard, gnu::no_dangling]] static const std::vector& +scanSingleByExt(const ssvufs::Path& path, const std::string& extension) { std::vector& buffer = getScanBuffer(); buffer.clear(); @@ -273,8 +273,8 @@ static void loadAssetsFromJson(AssetStorage& assetStorage, return buffer; } -[[nodiscard]] static const std::vector& scanSingleByName( - const ssvufs::Path& path, const std::string& name) +[[nodiscard, gnu::no_dangling]] static const std::vector& +scanSingleByName(const ssvufs::Path& path, const std::string& name) { std::vector& buffer = getScanBuffer(); buffer.clear(); @@ -285,8 +285,8 @@ static void loadAssetsFromJson(AssetStorage& assetStorage, return buffer; } -[[nodiscard]] static const std::vector& scanSingleFolderName( - const ssvufs::Path& path) +[[nodiscard, gnu::no_dangling]] static const std::vector& +scanSingleFolderName(const ssvufs::Path& path) { std::vector& buffer = getScanBuffer(); buffer.clear(); diff --git a/src/SSVOpenHexagon/Utils/Timeline2.cpp b/src/SSVOpenHexagon/Utils/Timeline2.cpp index 04bca5e79..90d108ee6 100644 --- a/src/SSVOpenHexagon/Utils/Timeline2.cpp +++ b/src/SSVOpenHexagon/Utils/Timeline2.cpp @@ -23,12 +23,12 @@ void timeline2::clear() void timeline2::append_do(const std::function& func) { - _actions.emplace_back(action{action_do{func}}); + _actions.emplace_back(action_do{func}); } void timeline2::append_wait_for(const duration d) { - _actions.emplace_back(action{action_wait_for{d}}); + _actions.emplace_back(action_wait_for{d}); } void timeline2::append_wait_for_seconds(const double s) @@ -43,12 +43,12 @@ void timeline2::append_wait_for_sixths(const double s) void timeline2::append_wait_until(const time_point tp) { - _actions.emplace_back(action{action_wait_until{tp}}); + _actions.emplace_back(action_wait_until{tp}); } void timeline2::append_wait_until_fn(const std::function& tp_fn) { - _actions.emplace_back(action{action_wait_until_fn{tp_fn}}); + _actions.emplace_back(action_wait_until_fn{tp_fn}); } [[nodiscard]] std::size_t timeline2::size() const noexcept