mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 08:35:20 +02:00
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.
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user