From c32dae8bdb7d1c4e36e071b790e654bdc10a60ca Mon Sep 17 00:00:00 2001 From: proller Date: Tue, 15 Oct 2024 14:34:23 +0200 Subject: [PATCH] fix --- src/mapblock.cpp | 18 +++++++++--------- src/mapblock.h | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mapblock.cpp b/src/mapblock.cpp index dbb096431..a872ce547 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -773,34 +773,34 @@ const MapBlock::mesh_type empty_mesh; #if BUILD_CLIENT const MapBlock::mesh_type MapBlock::getLodMesh(block_step_t step, bool allow_other) { - if (m_lod_mesh[step].load(std::memory_order::relaxed) || !allow_other) - return m_lod_mesh[step].load(std::memory_order::relaxed); + if (m_lod_mesh[step] || !allow_other) + return m_lod_mesh[step]; for (int inc = 1; inc < 4; ++inc) { - if (step + inc < m_lod_mesh.size() && m_lod_mesh[step + inc].load(std::memory_order::relaxed)) - return m_lod_mesh[step + inc].load(std::memory_order::relaxed); - if (step - inc >= 0 && m_lod_mesh[step - inc].load(std::memory_order::relaxed)) - return m_lod_mesh[step - inc].load(std::memory_order::relaxed); + if (step + inc < m_lod_mesh.size() && m_lod_mesh[step + inc]) + return m_lod_mesh[step + inc]; + if (step - inc >= 0 && m_lod_mesh[step - inc]) + return m_lod_mesh[step - inc]; } return empty_mesh; } const MapBlock::mesh_type MapBlock::getFarMesh(block_step_t step) { - return m_far_mesh[step].load(std::memory_order::relaxed); + return m_far_mesh[step]; } void MapBlock::setLodMesh(const MapBlock::mesh_type &rmesh) { const auto ms = rmesh->lod_step; - if (auto mesh = std::move(m_lod_mesh[ms].load(std::memory_order::relaxed))) + if (auto mesh = std::move(m_lod_mesh[ms])) delete_mesh = std::move(mesh); m_lod_mesh[ms] = rmesh; } void MapBlock::setFarMesh(const MapBlock::mesh_type &rmesh, block_step_t step) { - if (auto mesh = std::move(m_far_mesh[step].load(std::memory_order::relaxed))) { + if (auto mesh = std::move(m_far_mesh[step])) { delete_mesh = std::move(mesh); } m_far_mesh[step] = rmesh; diff --git a/src/mapblock.h b/src/mapblock.h index a85954e7b..a21623eb6 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -536,8 +536,8 @@ class MapBlock uint8_t mesh_requested_step {}; private: - std::array, LODMESH_STEP_MAX + 1> m_lod_mesh; - std::array, FARMESH_STEP_MAX + 1> m_far_mesh; + std::array m_lod_mesh; + std::array m_far_mesh; MapBlock::mesh_type delete_mesh; public: