diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-06-11 13:58:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-11 13:58:43 +0200 |
commit | 65819f3b9f8229666a30b91ef2d289ebc6085097 (patch) | |
tree | 722ba29a49ea1707c1db2633b2e84c5c7ebfe2eb /src/game.cpp | |
parent | ff73c7a5da6ab8ac0bb678ebf25b83e805397029 (diff) | |
download | dragonfireclient-65819f3b9f8229666a30b91ef2d289ebc6085097.tar.xz |
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.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/game.cpp b/src/game.cpp index ed7316a4d..c32ab6f30 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -3637,7 +3637,7 @@ PointedThing Game::updatePointedThing( std::vector<aabb3f> *selectionboxes = hud->getSelectionBoxes(); selectionboxes->clear(); hud->setSelectedFaceNormal(v3f(0.0, 0.0, 0.0)); - static const bool show_entity_selectionbox = g_settings->getBool( + static thread_local const bool show_entity_selectionbox = g_settings->getBool( "show_entity_selectionbox"); ClientMap &map = client->getEnv().getClientMap(); @@ -3980,7 +3980,7 @@ void Game::handleDigging(const PointedThing &pointed, const v3s16 &nodepos, bool is_valid_position; MapNode wasnode = map.getNodeNoEx(nodepos, &is_valid_position); if (is_valid_position) { - if (client->moddingEnabled() && + if (client->moddingEnabled() && client->getScript()->on_dignode(nodepos, wasnode)) { return; } |