Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Sep 22, 2024
1 parent 1681e94 commit 8c4bbe8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ if(NOT MSVC)
message(STATUS "Build with tcmalloc ${TCMALLOC_LIBRARY} ${PROFILER_LIBRARY}")
endif()

option(ENABLE_UNWIND "Enable unwind" 1)
# too noisy
option(ENABLE_UNWIND "Enable unwind" 0)
if(ENABLE_UNWIND)

if(USE_STATIC_LIBRARIES AND UNWIND_STATIC)
Expand Down
4 changes: 4 additions & 0 deletions src/client/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ void ISoundManager::reportRemovedSound(sound_handle_t id)

sound_handle_t ISoundManager::allocateId(u32 num_owners)
{
const auto lock = m_occupied_ids.lock_unique_rec();

while (m_occupied_ids.find(m_next_id) != m_occupied_ids.end()
|| m_next_id == SOUND_HANDLE_T_MAX) {
m_next_id = static_cast<sound_handle_t>(
Expand All @@ -89,6 +91,8 @@ sound_handle_t ISoundManager::allocateId(u32 num_owners)

void ISoundManager::freeId(sound_handle_t id, u32 num_owners)
{
const auto lock = m_occupied_ids.lock_unique_rec();

auto it = m_occupied_ids.find(id);
if (it == m_occupied_ids.end())
return;
Expand Down
3 changes: 2 additions & 1 deletion src/client/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#pragma once

#include "irr_v3d.h"
#include "threading/concurrent_unordered_map.h"
#include <limits>
#include <string>
#include <unordered_map>
Expand Down Expand Up @@ -55,7 +56,7 @@ constexpr sound_handle_t SOUND_HANDLE_T_MAX = std::numeric_limits<sound_handle_t
class ISoundManager
{
private:
std::unordered_map<sound_handle_t, u32> m_occupied_ids;
concurrent_unordered_map<sound_handle_t, u32> m_occupied_ids;
sound_handle_t m_next_id = 1;
std::vector<sound_handle_t> m_removed_sounds;

Expand Down
1 change: 1 addition & 0 deletions src/network/fm_clientpacketsender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ void Client::sendDrawControl() {
PACK(TOSERVER_DRAWCONTROL_WANTED_RANGE, (u32)draw_control.wanted_range);
PACK(TOSERVER_DRAWCONTROL_RANGE_ALL, (u32)draw_control.range_all);
PACK(TOSERVER_DRAWCONTROL_FARMESH, (u8)draw_control.farmesh);
PACK(TOSERVER_DRAWCONTROL_LODMESH, (u8)draw_control.lodmesh);
PACK(TOSERVER_DRAWCONTROL_FOV, draw_control.fov);
PACK(TOSERVER_DRAWCONTROL_BLOCK_OVERFLOW, false /*draw_control.block_overflow*/);

Expand Down
1 change: 1 addition & 0 deletions src/network/fm_networkprotocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,4 +497,5 @@ enum
TOSERVER_DRAWCONTROL_FARMESH,
TOSERVER_DRAWCONTROL_FOV,
TOSERVER_DRAWCONTROL_BLOCK_OVERFLOW, // not used
TOSERVER_DRAWCONTROL_LODMESH,
};

0 comments on commit 8c4bbe8

Please sign in to comment.