From 65819f3b9f8229666a30b91ef2d289ebc6085097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sun, 11 Jun 2017 13:58:43 +0200 Subject: Use thread_local instead from some static settings (#5955) thread_local permits to limit variable lifetime to thread duration. Use it on each setting place which uses static to cache variable result only for thread lifetime. This permits to keep the same performance level & reconfigure server from MT gui in those various variables places. Add thread_local to undersampling calculation too. --- src/network/serverpackethandler.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/network') diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index f33b1a523..6c766a37a 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -1380,7 +1380,9 @@ void Server::handleCommand_Interact(NetworkPacket* pkt) Check that target is reasonably close (only when digging or placing things) */ - static const bool enable_anticheat = !g_settings->getBool("disable_anticheat"); + static thread_local const bool enable_anticheat = + !g_settings->getBool("disable_anticheat"); + if ((action == 0 || action == 2 || action == 3 || action == 4) && (enable_anticheat && !isSingleplayer())) { float d = player_pos.getDistanceFrom(pointed_pos_under); -- cgit v1.2.3