diff --git a/Minecraft.World/Entities/Mobs/Villager.cpp b/Minecraft.World/Entities/Mobs/Villager.cpp index e6568fe54..732283c73 100644 --- a/Minecraft.World/Entities/Mobs/Villager.cpp +++ b/Minecraft.World/Entities/Mobs/Villager.cpp @@ -530,8 +530,7 @@ void Villager::addOffers(int addCount) } // shuffle the list to make it more interesting - std::random_device rd; - std::mt19937 g(rd()); + static thread_local std::mt19937 g(std::random_device{}()); std::shuffle(newOffers->begin(), newOffers->end(), g); if (offers == NULL) diff --git a/Minecraft.World/Network/Socket.cpp b/Minecraft.World/Network/Socket.cpp index f023effdb..09ee65810 100644 --- a/Minecraft.World/Network/Socket.cpp +++ b/Minecraft.World/Network/Socket.cpp @@ -318,7 +318,7 @@ void Socket::SocketInputStreamLocal::close() { m_streamOpen = false; EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - while(!s_hostQueue[m_queueIdx].empty()) s_hostQueue[m_queueIdx].pop(); + std::queue().swap(s_hostQueue[m_queueIdx]); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); } @@ -366,7 +366,7 @@ void Socket::SocketOutputStreamLocal::close() { m_streamOpen = false; EnterCriticalSection(&s_hostQueueLock[m_queueIdx]); - while(!s_hostQueue[m_queueIdx].empty()) s_hostQueue[m_queueIdx].pop(); + std::queue().swap(s_hostQueue[m_queueIdx]); LeaveCriticalSection(&s_hostQueueLock[m_queueIdx]); }