Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/wip5.8.0' into wip5.8.0webport
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Oct 14, 2024
2 parents 13da11b + dd1ab8a commit 3bfffd1
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 27 deletions.
6 changes: 3 additions & 3 deletions src/client/content_cao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ scene::ISceneNode *GenericCAO::getSceneNode() const
}

if (m_wield_meshnode) {
return m_wield_meshnode;
return m_wield_meshnode.get();
}

if (m_spritenode) {
Expand Down Expand Up @@ -585,7 +585,7 @@ void GenericCAO::removeFromScene(bool permanent)
m_animated_meshnode = nullptr;
} else if (m_wield_meshnode) {
m_wield_meshnode->remove();
m_wield_meshnode->drop();
//m_wield_meshnode->drop();
m_wield_meshnode = nullptr;
} else if (m_spritenode) {
m_spritenode->remove();
Expand Down Expand Up @@ -814,7 +814,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc, scene::ISceneManager *smgr)
*/
item.deSerialize(m_prop.wield_item, m_client->idef());
}
m_wield_meshnode = new WieldMeshSceneNode(m_smgr, -1);
m_wield_meshnode.reset(new WieldMeshSceneNode(m_smgr, -1));
m_wield_meshnode->setItem(item, m_client,
(m_prop.visual == "wielditem"));

Expand Down
2 changes: 1 addition & 1 deletion src/client/content_cao.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class GenericCAO : public ClientActiveObject
aabb3f m_selection_box = aabb3f(-BS/3.,-BS/3.,-BS/3., BS/3.,BS/3.,BS/3.);
scene::IMeshSceneNode *m_meshnode = nullptr;
scene::IAnimatedMeshSceneNode *m_animated_meshnode = nullptr;
WieldMeshSceneNode *m_wield_meshnode = nullptr;
std::shared_ptr<WieldMeshSceneNode> m_wield_meshnode;
scene::IBillboardSceneNode *m_spritenode = nullptr;
scene::IDummyTransformationSceneNode *m_matrixnode = nullptr;
Nametag *m_nametag = nullptr;
Expand Down
3 changes: 1 addition & 2 deletions src/client/fm_farmesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ void FarMesh::makeFarBlock(
blockpos_actual, std::make_pair(step, far_iteration_complete));

new_block = true;
block = std::make_shared<MapBlock>(
&client_map, blockpos_actual, m_client);
block.reset(client_map.createBlankBlockNoInsert(blockpos_actual));
block->far_step = step;
far_blocks.insert_or_assign(blockpos_actual, block);
++m_client->m_new_meshes;
Expand Down
23 changes: 13 additions & 10 deletions src/threading/concurrent_unordered_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,26 @@ class concurrent_unordered_map_ : public std::unordered_map<Key, T, Hash, Pred,
return full_type::operator=(std::forward<Args>(args)...);
}

mapped_type nothing = {};
const mapped_type nothing{};

template <typename... Args>
mapped_type &get(Args &&...args)
const mapped_type &get(Args &&...args) const
{
auto lock = LOCKER::lock_shared_rec();

if (!full_type::contains(std::forward<Args>(args)...))
return nothing;
const auto lock = LOCKER::lock_shared_rec();

return full_type::operator[](std::forward<Args>(args)...);
if (const auto &it = full_type::find(std::forward<Args>(args)...);
it != full_type::end()) {
return it->second;
}
return nothing;
}

const mapped_type &at_or(const key_type &k, const mapped_type &nothing = {}) const
template <typename... Args>
const mapped_type &at_or(Args &&...args) const
{
auto lock = LOCKER::lock_shared_rec();
if (const auto it = full_type::find(k); it != full_type::end()) {
const auto lock = LOCKER::lock_shared_rec();
if (const auto &it = full_type::find(std::forward<Args>(args)...);
it != full_type::end()) {
return it->second;
}
return nothing;
Expand Down
11 changes: 0 additions & 11 deletions src/threading/concurrent_unordered_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@ class concurrent_unordered_set_ : public std::unordered_set<Value, Hash, Pred, A

~concurrent_unordered_set_() { clear(); }

template <typename... Args>
const Value &at_or(Args &&...args, const Value &nothing = {}) const
{
auto lock = LOCKER::lock_shared_rec();
if (const auto it = full_type::find(std::forward<Args>(args)...);
it != full_type::end()) {
return *it;
}
return nothing;
}

LOCK_UNIQUE_PROXY(full_type, operator=);
LOCK_SHARED_PROXY(full_type, empty);
LOCK_SHARED_PROXY(full_type, size);
Expand Down

0 comments on commit 3bfffd1

Please sign in to comment.